Issue #13012 on hold

Put API call Returning an HTTP error of 400

Nathan Lang
created an issue

I am using python's requests and it works for every other API call that I have tried to call but it is not working for the API version 1 put call. Here is a copy of my code:

def postDescription(desc):
    un = "username" #not actual user name
    pw = "Password" # not actual password
    url = "https://api.bitbucket.org/1.0/repositories/{account}/test_repo_1"
    try:
        response = requests.put(url, data={"description": desc}, auth=(un, pw))
        response.raise_for_status()
        print(str(response.json()))
        print('Description added')
    except requests.HTTPError as e:
        print('ERROR: Description Update Code: ' + str(e.response) + '\n')


desc = 'Test Description'
postDescription(desc)

I have tried replacing the put with a get call and it works fine. I've looked over the API documentation and cant find where I am going wrong.

Comments (3)

  1. Log in to comment