devnzy...@use.startmail.com writes: > Has anyone ever used an authorization header with the requests library? I > tried using: > > >>>> from requests.auth import HTTPBasicAuth >>>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', >>>> 'pass') > > from their docs online but that's not working and I don't see anything about > authorization headers
We are using it like this (successfully): requests.post(url, data=data, params=params, auth=(user, passwd), timeout=timeout, verify=verify, headers=jsonHeaders, ) i.e. "user" and "password" are not wrapped into an "HTTPBasicAuth" but directly passed as tuple. However, I expect that it would also work with an "HTTPBasicAuth" wrapping. Note that you must pass the real username and password, not the literals "'user'" and "'pass'". -- https://mail.python.org/mailman/listinfo/python-list