summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Sadler <github@mashi.org>2014-10-25 13:54:34 +0200
committerScott Sadler <github@mashi.org>2014-10-25 16:51:51 +0200
commitcfd6e25749dd17c6b511043a6720b672f74029ed (patch)
tree94ca495c0bfe40add5ec964b1180ea0a8e810e6b
parent6b58a359e8af882eb3fd89a54e0a4db38c9afa2e (diff)
downloadpython-requests-cfd6e25749dd17c6b511043a6720b672f74029ed.tar.gz
fix failing test "test_prepare_unicode_url"
-rw-r--r--requests/models.py9
1 files 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):