Skip to content
Myr

Update sessions.py

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

Use `.format()` over `%` given PEP 3101

authored by Alan Yee · committed by GitHub · parent 4983a9b · Browse files · 1 file+3 added−3 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+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:requests/sessions.py+3 added-3 removed
160 unmodified lines
161 except (ChunkedEncodingError, ContentDecodingError, RuntimeError):162 resp.raw.read(decode_content=False)163164 if len(resp.history) >= self.max_redirects:165 raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, response=resp)165 raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)166167 # Release the connection back into the pool.168 resp.close()169170 # Handle redirection without scheme (see: RFC 1808 Section 4)171 if url.startswith('//'):172 parsed_rurl = urlparse(resp.url)173 url = '%s:%s' % (to_native_string(parsed_rurl.scheme), url)173 url = ':'.join([to_native_string(parsed_rurl.scheme), url])174175 # Normalize url case and attach previous fragment if needed (RFC 7231 7.1.2)176 parsed = urlparse(url)177 if parsed.fragment == '' and previous_fragment:
549 unmodified lines
727 if url.lower().startswith(prefix.lower()):728 return adapter729730 # Nothing matches :-/731 raise InvalidSchema("No connection adapters were found for '%s'" % url)731 raise InvalidSchema("No connection adapters were found for {!r}".format(url))732733 def close(self):734 """Closes all adapters and as such the session"""735 for v in self.adapters.values():
35 unmodified lines