Skip to content

Commit

Permalink
Prefetch for sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanmaguire committed Feb 28, 2012
1 parent 7cc898f commit 97815c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Patches and Suggestions
- Matt Giuca
- Adam Tauber
- Honza Javorek
- Brendan Maguire <maguire.brendan@gmail.com>
4 changes: 4 additions & 0 deletions requests/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self,
hooks=None,
params=None,
config=None,
prefetch=False,
verify=True):

self.headers = headers or {}
Expand All @@ -74,6 +75,7 @@ def __init__(self,
self.hooks = hooks or {}
self.params = params or {}
self.config = config or {}
self.prefetch = prefetch
self.verify = verify

for (k, v) in list(defaults.items()):
Expand Down Expand Up @@ -148,6 +150,7 @@ def request(self, method, url,
headers = {} if headers is None else headers
params = {} if params is None else params
hooks = {} if hooks is None else hooks
prefetch = self.prefetch or prefetch

# use session's hooks as defaults
for key, cb in list(self.hooks.items()):
Expand All @@ -172,6 +175,7 @@ def request(self, method, url,
allow_redirects=allow_redirects,
proxies=proxies,
config=config,
prefetch=prefetch,
verify=verify,
_poolmanager=self.poolmanager
)
Expand Down

0 comments on commit 97815c9

Please sign in to comment.