Open maingoh opened 3 years ago
Why is it necessary? Why does it make things easier for user?
It makes things easier for us. Caching a client for each user is not very convenient and optimized. The change for a single user is not very complicated also. We can also try to be retrocompatible, keep the previous auth for single user:
client = Client(api_key=api_key, host=host)
For multiple users:
session = Session(host=host)
user = session.user(api_key=api_key)
I believe you but can you be more specific about easier for us
?
In what context do you need to handle multiple users with one client ?
The only use-case I see so far is Vesta when performing actions on Vulcan on behalf of a user ?
Another use case is the customer api forwarding some requests to api.deepomatic.com using different api keys.
This is not urgent anyway, we are caching one client per user for now.
This would allow to use the same
requests.Session
with multiple users. This imply overriding the api key while doing the request.Probably we should have an interface like this:
Or
It might be a breaking changes. We could somehow make it retrocompatible though.