store hooks in Request.

This commit is contained in:
Kenneth Reitz
2011-10-13 20:19:59 -04:00
parent 5537902796
commit 892fcd6cc0
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -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,
+3 -1
View File
@@ -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.