From 9d170523662e7852432c8f82466db43c4a72091b Mon Sep 17 00:00:00 2001 From: William Cummings Date: Tue, 17 Sep 2013 12:17:12 -0400 Subject: [PATCH] kwarg for session Lets you pass in clients setup with requests_oauthlib --- hammock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hammock.py b/hammock.py index f00a4d1..74e7f85 100644 --- a/hammock.py +++ b/hammock.py @@ -7,7 +7,7 @@ class Hammock(object): HTTP_METHODS = ['get', 'options', 'head', 'post', 'put', 'patch', 'delete'] - def __init__(self, name=None, parent=None, append_slash=False, **kwargs): + def __init__(self, name=None, parent=None, append_slash=False, session=None, **kwargs): """Constructor Arguments: @@ -19,7 +19,7 @@ def __init__(self, name=None, parent=None, append_slash=False, **kwargs): self._name = name self._parent = parent self._append_slash = append_slash - self._session = requests.session() + self._session = session if session is not None else requests.session() for k, v in kwargs.items(): orig = getattr(self._session, k) # Let it throw exception if isinstance(orig, dict):