diff options
| author | Paul Matthews <pmatthews@google.com> | 2013-08-12 14:20:25 +0100 |
|---|---|---|
| committer | Paul Matthews <pmatthews@google.com> | 2013-08-12 15:27:17 +0100 |
| commit | 61617e74ed23d82393509c61aac07bfc5a5ea2e4 (patch) | |
| tree | 8dc8e92c68ae5260a07ed454eb40a946e55a2d1c | |
| parent | d3b786399e1a1041426cd6ab6a619b58a86d6300 (diff) | |
| download | python-requests-61617e74ed23d82393509c61aac07bfc5a5ea2e4.tar.gz | |
Raise an error for unsupported hook event
* Raises a ValueError for an unsupported hook event
| -rw-r--r-- | requests/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/requests/models.py b/requests/models.py index 6b4a2994..007a9f1c 100644 --- a/requests/models.py +++ b/requests/models.py @@ -141,6 +141,9 @@ class RequestHooksMixin(object): def register_hook(self, event, hook): """Properly register a hook.""" + if event not in self.hooks: + raise ValueError('Unsupported event specified, with event name "%s"' % (event)) + if isinstance(hook, collections.Callable): self.hooks[event].append(hook) elif hasattr(hook, '__iter__'): |
