Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

bitbucket api errors out when listing total repos in a project using python function

I am using the below python function for getting total number of repos in a project

def new_slug_test():
req = requests.get(GITBASEURL + "/projects/" +
'G4FLIGHTWS' + "/repos", headers=BITBUCKETHEADERS)
NEW_SLUG_LIST = []
while True:
for slugs in req.json()['values']:
try:
print(slugs['slug'])
NEW_SLUG_LIST.append(slugs['slug'])
except ValueError:
print("Oops")
if req.json()['isLastPage']:
break
else:
print("hello , its not the last page")
req = requests.get(GITBASEURL + "/projects" +
'G4FLIGHTWS' + "/repos" + "?start=" +
str(req.json()['nextPageStart']), headers=BITBUCKETHEADERS)


Indentations got screwed here bcz of formatting, but this is the exact function i am using to get the complete list of repos which is more than 25 , but looks like its just not going beyong 25 items or the next page and errors out like below :

 

g4-checkinboard-bso
g4-checkinboard-bso-client
g4-flight-ancillary-bso
g4-flight-ancillary-bso-client
g4-flight-base
g4-flight-common
g4-flight-common-client
g4-flight-custcoms
g4-flight-disposition
g4-flight-disposition-bso
g4-flight-disposition-orch
g4-flight-fare
g4-flight-fares-bso
g4-flight-fares-bso-client
g4-flight-inventory
g4-flight-management-bso
g4-flight-management-bso-client
g4-flight-order-bso
g4-flight-order-bso-client
g4-flight-payment
g4-flight-record
g4-flight-report-bso
g4-flight-reservation
g4-flight-schedules
g4-flight-schedules-bso
hello , its not the last page
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 6, in new_slug_test
File "/home/em7b/.local/lib/python3.5/site-packages/requests/models.py", line 884, in json
self.content.decode(encoding), **kwargs
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

 

I would like this to be fixed or if there is any other way ?

 

1 answer

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

2,120 views 11 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you