Reputation: 5580
Bitbucket doesn't expose this information in the web interface, so I'll likely need to find it using the API.
Upvotes: 2
Views: 6477
Reputation: 344
Some examples:
and search for the size
entry in the response (eg: "size": 7)
Upvotes: 2
Reputation: 5580
The following python code uses the requests library to interact with the bitbucket API. It should print the number of merged pull requests authored by the bitbucket account my_bb_username
. Note that you will need to edit url0
to point to the appropriate repository.
import requests
numprs = 0
url0 = "https://bitbucket.org/api/2.0/repositories/{username}/{reposlug}/pullrequests/?state=merged"
url = url0
while True:
r = requests.get(url)
if r.status_code != 200:
raise RuntimeError
data = r.json()
values = data['values']
for value in values:
if value['author']['username'] == 'my_bb_username':
print value['title']
numprs += 1
if 'next' in data.keys():
url = data['next']
else:
break
print numprs
If you want a list of all PRs, append ?state=merged,open,declined
to your API call. By default, the API will only include open PRs.
Upvotes: 1