-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add support for Bearer token strings for auth #282
Conversation
import kinto_http | ||
from kinto_http import utils |
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.
Any reason in particular you chose not to import BearerTokenAuth
from kinto_http
when we're already importing utils? Not a big deal, just curious
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.
I didn't really think about it. I had kinto_http.BearerTokenAuth
in mind and imported the top module to get it...
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.
Ah well, my subconscious was probably aware that it would raise:
ImportError: cannot import name 'BearerTokenAuth' from partially initialized module 'kinto_http' (most likely due to a circular import) (/Users/mathieu/Code/Mozilla/kinto-http.py/kinto_http/__init__.py)
🤣
kinto_http/tests/test_session.py
Outdated
|
||
|
||
def test_auth_can_be_an_arbitrary_string(session_setup: Tuple[MagicMock, Session]): | ||
session = create_session(auth="Some abcdef") |
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.
I'm surprised this is supported by requests
. Is this actually a valid form of authentication?
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.
Looking at https://requests.readthedocs.io/en/latest/_modules/requests/models/#PreparedRequest.prepare_auth
Auth can only be a tuple or a callable.
Will fix code and tests
No description provided.