mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
A possible fix for #1036
I can only assume that the only possible thing to close on a session are the adapters. As such, I wrote the close method for a session object which closes all possible adapters.
This commit is contained in:
@@ -365,7 +365,12 @@ class Session(SessionRedirectMixin):
|
||||
return adapter
|
||||
|
||||
# Nothing matches :-/
|
||||
raise InvalidSchema('No connection adapters were found for \'%s\'' % url)
|
||||
raise InvalidSchema("No connection adapters were found for '%s'" % url)
|
||||
|
||||
def close(self):
|
||||
"""Closes all adapters and as such the session"""
|
||||
for _, v in self.adapters.items():
|
||||
v.close()
|
||||
|
||||
def mount(self, prefix, adapter):
|
||||
"""Registers a connection adapter to a prefix."""
|
||||
|
||||
Reference in New Issue
Block a user