From 892fcd6cc0cadd8308fa55f229cc611377dfe07d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 13 Oct 2011 20:19:59 -0400 Subject: [PATCH] store hooks in Request. --- requests/api.py | 1 + requests/models.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requests/api.py b/requests/api.py index e9fd9e7..89eb44c 100644 --- a/requests/api.py +++ b/requests/api.py @@ -54,6 +54,7 @@ def request(method, url, cookiejar = cookies, files = files, auth = auth, + hooks = hooks, timeout = timeout or config.settings.timeout, allow_redirects = allow_redirects, proxies = proxies or config.settings.proxies, diff --git a/requests/models.py b/requests/models.py index b3a60c2..dc7c79c 100644 --- a/requests/models.py +++ b/requests/models.py @@ -37,7 +37,7 @@ class Request(object): def __init__(self, url=None, headers=dict(), files=None, method=None, data=dict(), params=dict(), auth=None, cookiejar=None, timeout=None, redirect=False, - allow_redirects=False, proxies=None): + allow_redirects=False, proxies=None, hooks=None): #: Float describ the timeout of the request. # (Use socket.setdefaulttimeout() as fallback) @@ -94,6 +94,8 @@ class Request(object): #: True if Request has been sent. self.sent = False + #: Event-handling hooks. + self.hooks = hooks # Header manipulation and defaults. -- 2.7.4