Merge pull request #516 from EnTeQuAk/move_pre_request

Move pre_request to a more usable place, followup to #382
This commit is contained in:
Kenneth Reitz
2012-05-02 15:58:08 -07:00
+4 -4
View File
@@ -461,6 +461,10 @@ class Request(object):
# Build the URL
url = self.full_url
# Pre-request hook.
r = dispatch_hook('pre_request', self.hooks, self)
self.__dict__.update(r.__dict__)
# Logging
if self.config.get('verbose'):
self.config.get('verbose').write('%s %s %s\n' % (
@@ -566,10 +570,6 @@ class Request(object):
if cookie_header is not None:
self.headers['Cookie'] = cookie_header
# Pre-request hook.
r = dispatch_hook('pre_request', self.hooks, self)
self.__dict__.update(r.__dict__)
try:
# The inner try .. except re-raises certain exceptions as
# internal exception types; the outer suppresses exceptions