Conversation
|
I think that this will have problems with HTTP requests apart from GET (have you tested PUT/PUSH/DELETE?) 'cause the authorization header is overwritten by basic auth. I fixed all these just yesterday (I wish I could see your request earlier...). Have a look #176 |
|
@dzervas yes, you are correct, I didn't test with other requests :/ can you please fix example: 3164a0b#diff-8a23d682236897c1a2f5bafede722cb3L28 ? |
|
I think that the example should not be fixed, as the private key is not static (and you should give that "feel" in the documentation). It's not doing the whole auth thing (you have to talk with the server to gain the key). |
gpocentek
left a comment
There was a problem hiding this comment.
Please see my suggestion inline, I think there's a nicer way to handle both oauth and basic HTTP auth.
Thanks!
| auth = requests.auth.HTTPBasicAuth( | ||
| self.http_username, | ||
| self.http_password) | ||
|
|
There was a problem hiding this comment.
There is one thing bothering me here: with oauth token we explicitly define headers, with basic HTTP auth we don't and use a python-requests feature instead. I'd prefer to have the same method for both authentication methods.
Updating the _create_headers method might be the easiest way to achieve consistency. This would also avoid code duplication in the _raw_* methods.
What do you think about this?
authorization header doesn't have a colon in it's value, requests' auth parameter overrides custom authorization header
(and there was a PEP8 error for line 441)