-
-
Notifications
You must be signed in to change notification settings - Fork 426
Preventing sending Basic Auth headers with "None:None" #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
requests_oauthlib/oauth2_session.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's tighten this up a little bit if you don't mind. =)
Firstly, we can remove the auth or portion of this line: we already know auth is false, that's how we got here, so no need to check it again.
Secondly, let's add a line inside this block that asserts that password is truthy.
Thirdly and finally, let's remove the parentheses around username in the conditional: they're not needed. =)
|
Thanks! Some small notes. =) |
|
Should I make those changes? Or are you already on it? |
|
I'm happy for you to do it. =) |
|
For the password, I guess an empty password is OK? I'll then compare it with And with this code, if username is empty string, it won't use Basic Auth, but I am not sure if empty string is a valid username or password. |
|
@chaosct I don't believe an empty string is a valid username. |
|
Let me know if more changes are needed |
requests_oauthlib/oauth2_session.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, reading this now I find the operator precedence confusing. Let's do if (not auth) and username just to indicate what's going on here.
|
Beautiful, almost perfect. One tiny change and then it's good to go! |
|
Done! |
|
\o/ Perfect! Thanks @chaosct! |
Preventing sending Basic Auth headers with "None:None"
|
Can a new release be created to include these changes please? Installing master straight from Github is not ideal. |
|
@citizenken it would appear this results in a new bug so creating a release right now does not seem ideal |
Closes #211