From: Ian Cordasco Date: Tue, 18 Dec 2012 14:43:55 +0000 (-0500) Subject: A possible fix for #1036 X-Git-Tag: v1.0.4~35^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14da5cf180c4776f6a4aeeb8a6979ee885fc8c82;p=services%2Fpython-requests.git 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. --- diff --git a/requests/sessions.py b/requests/sessions.py index 0d1441b..36a760d 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -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."""