How can I print the status code for this response? (eg 200/401 etc)
resp = http.urlopen('POST', 'https://api.bitbucket.org/2.0/repositories/6789oh', headers=headers, body=json.dumps(data))
print(str(resp.data))
I tried:
resp.code
resp.get_code()
etc but none of them work for http.urlopen.
I would use urllib.request , try this see if it helps
import urllib.request , json
try:
except urllib.error.URLError as a :
except urllib.error.URLError as e :