Skip to content
Myr

Merge pull request #2326 from sigmavirus24/close-functional-sessions

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close sessions created in the functional API

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 19b8e30, 3155bc9 · Browse files · 1 file+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−1 removed

  • other:+6 added−1 removed

1 file+6 added−1 removed

modified:requests/api.py+6 added-1 removed
44 unmodified lines
45 <Response [200]>46 """4748 session = sessions.Session()49 return session.request(method=method, url=url, **kwargs)49 response = session.request(method=method, url=url, **kwargs)50 # By explicitly closing the session, we avoid leaving sockets open which51 # can trigger a ResourceWarning in some cases, and look like a memory leak52 # in others.53 session.close()54 return response555657def get(url, **kwargs):58 """Sends a GET request. Returns :class:`Response` object.
73 unmodified lines