-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requests arguments #105
Comments
Good idea. I shall do this! Thanks for the suggestion |
For most / all things you mentioned, you can also pass in your own |
@jhermann I think it should be a simple fix of adding kwargs to the API class to set values such as timeouts,stream,proxy,even user-agent to the requests.Session instance stored in self._store . |
Added the ability to pass session wide parameters to the requests.Session object.
Closing samgiles#105 and using this as a replacement PR. I think it would be better to document these options instead of changing the API object.
Added the ability to pass session wide parameters to the requests.Session object.
FWIW, timeouts can't actually be set in a class TimeoutHTTPAdapter(HTTPAdapter):
def __init__(self, timeout=None, *args, **kwargs):
self.timeout = timeout
super().__init__(*args, **kwargs)
def send(self, *args, **kwargs):
kwargs['timeout'] = self.timeout
return super().send(*args, **kwargs)
_session = Session()
_session.mount("http://", TimeoutHTTPAdapter(timeout=3)) Which is quite a lot of boilerplate for what I think is probably a pretty common requirement. |
Hi Sam,
what do you think about passing requests parameters through slumber such as
timeout
,proxies
,stream
, etc. At this moment the only way is to overwrite slumber's_request
method.I will create PR if you support this decision.
Cheers,
Alex
The text was updated successfully, but these errors were encountered: