"""
data = kwargs.pop('data', dict()) or kwargs.pop('params', dict())
- r = Request(method=method, url=url, data=data, headers=kwargs.pop('headers', {}),
- cookiejar=kwargs.pop('cookies', None),
- files=kwargs.pop('files', None),
- auth=kwargs.pop('auth', auth_manager.get_auth(url)),
- timeout=kwargs.pop('timeout', config.settings.timeout),
- allow_redirects=kwargs.pop('allow_redirects', None)
+ r = Request(method=method, url=url, data=data, headers=kwargs.pop('headers', dict()),
+ cookiejar=kwargs.get('cookies', None),
+ files=kwargs.get('files', None),
+ auth=kwargs.get('auth', auth_manager.get_auth(url)),
+ timeout=kwargs.get('timeout', config.settings.timeout),
+ allow_redirects=kwargs.get('allow_redirects', None)
)
r.send()
# cache previous settings for __exit__
r.__cache = self.__dict__.copy()
+ map(self.__cache.setdefault, self.__attrs__)
# set new settings
self.__dict__.update(*args, **kwargs)
def __exit__(self, *args):
# restore cached copy
+ print '>>> {0}'.format(self.__cache)
self.__dict__.update(self.__cache.copy())
del self.__cache