-
-
Notifications
You must be signed in to change notification settings - Fork 999
No-I/O generator-based authentication flows #645
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
|
One pending question — if this gets in, do we want users to be able to provide a custom def my_custom_auth(request):
request.headers["Authorization"] = "Custom: 1234"
yield request
r = await client.get(..., auth=my_custom_auth)This would require exposing the That said, even allowing users to create an |
|
My suggestion at the moment would be that we come back to considering this at another point. I think it's probably a bit too much of an atypical style to be obvious to users, tho might be up for being convinced on it? We can punt on it at the moment, since custom auth classes are currently private API, with our public API being...
Granted we don't support custom multi-request auth as a public API at the moment, but that's okay. |
|
Well, it can very much stay an internal style for now — were not exposing Auth yet anyway, so I can withdraw the change that adds generator functions to the public API. I’d just prefer this over the on_request/on_response callbacks anyway, even for private use, because it enforces the order of requests much more cleanly and easily than a callback style does. |
|
Gotcha. How about...
That way we can make sure that the generator style flow gets a PR that includes documentation and public API changes, seperately from the internal work of "DigestAuth can now be used with a sync or async client". ? |
|
Ah, re-reads and sees this...
Ya. 😃 |
|
@tomchristie Updated the PR. :-) |
|
Neato. Working on this highlighted a couple of things to me:
I'd suggest we treat those seperately, since we're not regressing any behavior here, just noticing edges that we ought deal with more gracefully. |
@tomchristie This is an implementation of the intuition I mentioned on Gitter — that it might be possible to use generators for #644.
Pros:
I really think it's worth considering, although it relies on some advanced knowledge of the generator protocol.