atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[Bitbucket Cloud] pullrequests pagination invalid URL (using each)

Open rivoric opened this issue 5 years ago • 3 comments

Using pullrequests.each() only works if the number of open pull requests fits in a single page (<=10). The first call (without a page number) works but the second call fails. Debug shows the following 2 calls

https://api.bitbucket.org:443 "GET /2.0/repositories/summitmedia/automotive-retail-frontend/pullrequests/ HTTP/1.1" 200 None https://api.bitbucket.org:443 "GET /2.0/repositories/summitmedia/automotive-retail-frontend/pullrequests/?page=2/ HTTP/1.1" 400 55

The problem is the trailing slash is added to the end of the URL giving the invalid page number, ie 2/

The value of next being returned from the first call is correct. The each method sets trailing=True and this causes the trailing slash to be added on subsequent calls. I think either not setting this to true or having _get_paged set trailing=False if there is next value (similar to how it sets absolute=True) would fix it.

rivoric avatar Jun 29 '21 11:06 rivoric

@gonchik This can be closed.

Spacetown avatar Jul 12 '21 20:07 Spacetown

Thank you @Spacetown :)

gonchik avatar Jul 13 '21 05:07 gonchik

It seems that the issue still persists This is what I get when trying to get PR's in Cloud via each(q='state="declined"') https://api.bitbucket.org/2.0/repositories/repo/project/pullrequests/?q=state+%3D+%22declined%22&page=2/

n1n3b1t avatar Oct 07 '21 13:10 n1n3b1t