python-graphql-client
python-graphql-client copied to clipboard
Support Request Sessions
Is your feature request related to a problem? Please describe. I'm frustrated by the fact that I cannot use a custom request Session in this library. There are times I would like to modify how requests makes HTTP request (e.g. add authentication cookies, mTLS certificates, etc) and cannot do so with this library.
Describe the solution you'd like
The GraphqlClient
constructor takes in an optional session parameter. If none is passed, then the constructor instantiates the default Session.
Describe alternatives you've considered
I copy graphql_client.py
, make the fix. This orphan the solution from the codebase.
Additional context I already successfully did this and would like to PR it back
Thanks @davidhessler for the interest, you are more than welcome to contribute to the project. Please ensure when creating a pull request to include appropriate unit tests.
This feature might also be useful for times you want to override the netrc file of the system: https://github.com/psf/requests/issues/3929 Which can only be achieved with requests module by using a Session object with trust_env arguement set to False
Thanks for the input @uriyay, I left some comments on your PR.