environment: OS xUbuntu 18.04.4; Python 3.6.9; httplib2==0.9.2
I'm using httplib2 in such Python code (for some REST POST-request testing):
import httplib2, json
httplib2.debuglevel = 4
h = httplib2.Http('.cache')
data = {"quantity": 1,"product": 15, "product_code": "1004"}
data = json.dumps(data)
restEndpointURL='http://localhost:8000/shop/api/cart/?format=json'
h.add_credentials('a_login', 'a_password', 'localhost')
headersDict={'Content-Type':'application/json','accept':'application/json'}
response, content = h.request(restEndpointURL,'POST',data,headers=headersDict)
According to this code (httplib2.debuglevel and add_credentials) I suppose to see in the httplib2 debug output something like:
Authorization: Basic blablabla
but there is nothing like this.
So I need some ideas - how to check out what exactly was sent by httplib2 to the server?
UPDATED.
Well, looks like code h.add_credentials('a_login', 'a_password', 'localhost') doesn't work at all.
I checked it adding requests-logging functionality to my backend (that's django-shop server) and than executing the same POST-request via curl utility with corresponding --user parameter. So using curl-command I got what I waited to see - 'Authorization': 'Basic blablabla' in the log-while (headers dictionary), but using httplib2 with add_credentials I got nothing like this.
UPDATED-2.
I updated my httplib2 from it's official github repository to the 0.18.1 (gzip) version (the last one) - and got the same result.