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
Don't close user-provided requests sessions #232
Conversation
sgqlc/endpoint/requests.py
Outdated
@@ -109,7 +109,13 @@ def __init__(self, url, base_headers=None, timeout=None, method='POST', | |||
self.timeout = timeout | |||
self.method = method | |||
self.auth = auth | |||
self.session = session | |||
self.session = session or requests.Session() | |||
self.close_session = session is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this flipped? You want to close if or requests.Session()
, in this case session is None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad
failing tests checks the string serialization without |
Tried to execute the test on windows, but it horrible fails in the initialization:
So I'll have to rely on Github actions to check if the tests are fixed. |
Pull Request Test Coverage Report for Build 5315290371
💛 - Coveralls |
thanks |
Description
If the user has provided a requests session in the RequestsEndpoint constructor, it will not be closed after each request anymore.
If no session was provided, one will be created in the constructor and closed in the destructor.
Related Issues
Closes #225
Pull request checklist
How to test it
Change the Github Agile Dashboard example the following way
urllib3.connectionpool
logger