Closed ricfaith closed 3 years ago
@ricfaith I'll have a look at it this weekend. Sounds like a good change
@ricfaith merged your code with a small change: I added a close method allowing to explicitly close the session also. exiting code can be extended that way by simply adding the line:
client = API(...)
client.request(...)
client.close()
thanks!
Support
with
statement from PEP343 Close requests.Session on exitThe unclosed requests.Session was throwing an unclosed socket in my unit tests. Similar findings were found in https://stackoverflow.com/questions/48160728/resourcewarning-unclosed-socket-in-python-3-unit-test The stackoverflow link shows some other suitable workarounds.