Hi, I would like to know how to use bitbucket API using python requests. I love bitbucket, and using the API is very important to my main project. My attempts and failed tries are all at http://stackoverflow.com/questions/31061227/curl-vs-python-requests-when-hitting-apis which will give anyone answering a good starting point. Thank you,
Cody
Community moderators have prevented the ability to post new answers.
Hello Cody,
Thank you for your question.
# =============== # get user # =============== import requests import json # [BITBUCKET-BASE-URL], i.e.: https://bitbucket.org/ url = '[BITBUCKET-BASE-URL]/api/1.0/user/' headers = {'Content-Type': 'application/json'} # get user # [USERNAME], i.e.: myuser # [PASSWORD], i.e.: itspassword r = requests.get(url, auth=('[USERNAME]', '[PASSWORD]'), headers=headers) print(r.status_code) print(r.text) #print(r.content)
Please, refer to http://restbrowser.bitbucket.org/ for further API calls.
If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.
Thank you for your understanding.
—
Kind regards,
Rafael P. Sperafico
Atlassian Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.