From a6f7f5dc6211d672ed347f22602122013c7dee43 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Wed, 31 May 2017 10:39:27 +0100 Subject: [PATCH] Clean up flake8 errors from merge --- requests/models.py | 4 ++-- requests/sessions.py | 2 +- requests/utils.py | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/requests/models.py b/requests/models.py index 7fe99185..0b65e3a2 100644 --- a/requests/models.py +++ b/requests/models.py @@ -21,7 +21,7 @@ from urllib3.fields import RequestField from urllib3.filepost import encode_multipart_formdata from urllib3.util import parse_url from urllib3.exceptions import ( - DecodeError, ReadTimeoutError, ProtocolError, LocationParseError, ConnectionError) + DecodeError, ReadTimeoutError, ProtocolError, LocationParseError) from io import UnsupportedOperation from .hooks import default_hooks @@ -502,7 +502,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): def prepare_content_length(self, body): """Prepares Content-Length header. - + If the length of the body of the request can be computed, Content-Length is set using ``super_len``. If user has manually set either a Transfer-Encoding or Content-Length header when it should not be set diff --git a/requests/sessions.py b/requests/sessions.py index f3aa9e1a..629c8148 100755 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -124,7 +124,7 @@ class SessionRedirectMixin(object): reached. """ - history = [response] # keep track of history; seed it with the original response + history = [response] # keep track of history; seed it with the original response location_url = self.get_redirect_target(response) diff --git a/requests/utils.py b/requests/utils.py index 3be8c170..3a29183e 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -788,6 +788,7 @@ def parse_header_links(value): return links + def is_valid_location(response): """Verify that multiple Location headers weren't returned from the last response. @@ -800,6 +801,7 @@ def is_valid_location(response): # If response.raw isn't urllib3-like we can't reliably check this return True + # Null bytes; no need to recreate these on each call to guess_json_utf _null = '\x00'.encode('ascii') # encoding to ASCII for Python 3 _null2 = _null * 2