Skip to content
Myr

move hooks into api layer only

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 7836536 · Browse files · 2 files+12 added−10 removed
This commit

State

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

Diff stats

2 files+12 added−10 removed

  • other:+12 added−10 removed

2 files+12 added−10 removed

modified:requests/api.py+12 added
51 unmodified lines
52 allow_redirects = allow_redirects,53 proxies = proxies or config.settings.proxies,54 )5556 # Arguments manipulation hook.57 args = dispatch_hook('args', hooks, args)585960 r = Request(hooks=hooks, **args)6162 # Pre-request hook.63 r = dispatch_hook('pre_request', hooks, r)6465 # Send the HTTP Request.66 r.send()6768 # Post-request hook.69 r = dispatch_hook('post_request', hooks, r)7071 # Response manipulation hook.72 r.response = dispatch_hook('response', hooks, r.response)7374 return r.response757677def get(url, **kwargs):
101 unmodified lines
modified:requests/models.py-10 removed
14 unmodified lines
15from urlparse import urlparse, urlunparse, urljoin16from datetime import datetime1718from .config import settings19from .hooks import dispatch_hook19from .monkeys import Request as _Request, HTTPBasicAuthHandler, HTTPForcedBasicAuthHandler, HTTPDigestAuthHandler, HTTPRedirectHandler20from .structures import CaseInsensitiveDict21from .packages.poster.encode import multipart_encode22from .packages.poster.streaminghttp import register_openers, get_handlers
303 unmodified lines
326 try:327 opener = self._get_opener()328 try:329331 # pre-request hook.332 self.__dict__.update(333 dispatch_hook('pre_request',334 self.hooks, self.__dict__)335 )336330 resp = opener(req, timeout=self.timeout)331332 except TypeError, err:333 # timeout argument is new since Python v2.6
28 unmodified lines
362363364 self.sent = self.response.ok365373 self.__dict__.update(374 dispatch_hook('post_request', self.hooks, self.__dict__))375366 return self.sent367368369
235 unmodified lines