Howto use python urllib2 to create service POST with bitbucket API?
While this code works fine to add a deployment ssh-key to my repos... print 'Connecting to Bitbucket...' bitbucket_access = base64.b64encode(userbb + ":" + passwordbb) bitbucket_headers = {"Content-Type":"application/json", "Authorization":"Basic " + bitbucket_access} bitbucket_request_url = "https://bitbucket.org/api/1.0/repositories/<username>/%s/deploy-keys" % project_name bitbucket_request_req = urllib2.Request(bitbucket_request_url) for key,value in bitbucket_headers.items(): bitbucket_request_req.add_header(key,value) request_data = json.dumps({"key":public_key, "label":subproject})