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

Close sessions created in the functional API
This commit is contained in:
2014-11-12 12:34:14 -05:00
+6 -1
View File
@@ -46,7 +46,12 @@ def request(method, url, **kwargs):
"""
session = sessions.Session()
return session.request(method=method, url=url, **kwargs)
response = session.request(method=method, url=url, **kwargs)
# By explicitly closing the session, we avoid leaving sockets open which
# can trigger a ResourceWarning in some cases, and look like a memory leak
# in others.
session.close()
return response
def get(url, **kwargs):