From cfd6e25749dd17c6b511043a6720b672f74029ed Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Sat, 25 Oct 2014 13:54:34 +0200 Subject: fix failing test "test_prepare_unicode_url" --- requests/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/requests/models.py b/requests/models.py index 17e55988..8cc6e3b7 100644 --- a/requests/models.py +++ b/requests/models.py @@ -22,8 +22,8 @@ from .packages.urllib3.util import parse_url from .packages.urllib3.exceptions import ( DecodeError, ReadTimeoutError, ProtocolError) from .exceptions import ( - HTTPError, RequestException, MissingSchema, InvalidURL, - ChunkedEncodingError, ContentDecodingError, ConnectionError, + HTTPError, RequestException, MissingSchema, InvalidURL, + ChunkedEncodingError, ContentDecodingError, ConnectionError, StreamConsumedError) from .utils import ( guess_filename, get_auth_from_url, requote_uri, @@ -511,8 +511,9 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): def prepare_hooks(self, hooks): """Prepares the given hooks.""" - for event in hooks: - self.register_hook(event, hooks[event]) + if hooks is not None: + for event in hooks: + self.register_hook(event, hooks[event]) class Response(object): -- cgit v1.2.1