Skip to content
Myr

Move hooks into internal event loop

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 4916b1c · Browse files · 1 file+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−0 removed

  • other:+12 added−0 removed

1 file+12 added−0 removed

modified:requests/models.py+12 added
14 unmodified lines
15from urllib2 import HTTPError16from urlparse import urlparse, urlunparse, urljoin17from datetime import datetime1819from .hooks import dispatch_hook20from .structures import CaseInsensitiveDict21from .packages.poster.encode import multipart_encode22from .packages.poster.streaminghttp import register_openers, get_handlers23from .utils import (dict_from_cookiejar, get_unicode_from_response, stream_decode_response_unicode, decode_gzip, stream_decode_gzip)
97 unmodified lines
121 headers[k] = v122123 self.headers = headers124125 # Pre-request hook.126 r = dispatch_hook('pre_request', hooks, self)127 self.__dict__.update(r.__dict__)128129130 def __repr__(self):131 return '<Request [%s]>' % (self.method)132133
256 unmodified lines
390391392 self.sent = self.response.ok393394 # Response manipulation hook.395 self.response = dispatch_hook('response', self.hooks, self.response)396397 # Post-request hook.398 r = dispatch_hook('post_request', self.hooks, self)399 self.__dict__.update(r.__dict__)400401 return self.sent402403404class Response(object):
117 unmodified lines