python-graphql-client icon indicating copy to clipboard operation
python-graphql-client copied to clipboard

Support Request Sessions

Open davidhessler opened this issue 1 year ago • 3 comments

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

davidhessler avatar Mar 10 '23 14:03 davidhessler

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.

xkludge avatar Mar 10 '23 14:03 xkludge

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

uriyay avatar Mar 20 '24 19:03 uriyay

Thanks for the input @uriyay, I left some comments on your PR.

xkludge avatar Mar 21 '24 15:03 xkludge