Replies: 3 comments 2 replies
-
Good question. Could give an example of the kind of functionality you're trying to achieve here, just for a bit more context? |
Beta Was this translation helpful? Give feedback.
-
The use case is baking-in an API token flow into the client object and fetching new tokens from the token endpoint automatically when needed. It would be great reusing the same client instance so that the connection can be reused, and also because it has already been configured with e.g. the Further context: So the use case is basically what is shown in the docs for customizing authentication, which I was initially going to use instead of a custom transport since a token flow seems like one of the primary intended use cases for a custom auth class. The reason for going with a custom transport instead is that I just haven't been able to think of a clean way to prevent repeatedly triggering the token fetch in Nonetheless, my use case applies to both custom auth and custom transport classes; having access to their own client session would be useful to both of them. |
Beta Was this translation helpful? Give feedback.
-
(got this to work but it's a bit clunky, see reply below) |
Beta Was this translation helpful? Give feedback.
-
Is there a clever way for the Custom Transport
handle_request()
method to access the client instance that called it, so that the same client session can be re-used for any outgoing requests?To prevent the outgoing request from calling
handle_request()
again,extensions
would be used.Beta Was this translation helpful? Give feedback.
All reactions