Skip to content
Myr

A possible fix for #1036

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

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.

authored by Ian Cordasco · committed by Ian Cordasco · parent 6acce57 · 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/sessions.py+6 added-1 removed
363 unmodified lines
364 if url.startswith(prefix):365 return adapter366367 # Nothing matches :-/368 raise InvalidSchema('No connection adapters were found for \'%s\'' % url)368 raise InvalidSchema("No connection adapters were found for '%s'" % url)369370 def close(self):371 """Closes all adapters and as such the session"""372 for _, v in self.adapters.items():373 v.close()374375 def mount(self, prefix, adapter):376 """Registers a connection adapter to a prefix."""377 self.adapters[prefix] = adapter378
12 unmodified lines