-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Parameters are getting out of hand. #69
Comments
Interesting idea! Are you thinking something along the lines of... with requests.settings(path='http://example.org', timeout=10) as r:
response = r.get('/path/to/file.txt') ...? |
Heh, neat path idea. I was thinking: with requests.settings(timeout=10, auth=('a', 'b'), proxies={'http': 'localhost:8080'}):
requests.get('http://blah.com/', params={'x': 'y'}) |
either way I think that's awesome. |
Let's do it :) |
Maybe this would be better: with requests.settings(timeout=10, auth=('a', 'b'), proxies={'http': 'localhost:8080'}) as r:
r.get('http://blah.com/') This would escape the threading/processes issues. |
If there's a way to detect if someone's using |
My thought is always that explicit is better than implicit. And intuitiveness goes along with it. So then are context processors more explicit and are they intuitive? This does look like a divergence from the intuitive aspect of Requests that I like so much. I can point other newbies at it and they just get it. I'm open to ideas, but keep in mind your audience. Use of context processors could be for advanced users, and be given appropriate documentation. |
Great points. If I do decide to implement this, it would be supplementary. All of the functions will accept the same paramaters they do now as well. |
Maybe I'll hold off on this for now. Currently, you can do the following >>> with requests.settings(verbose=sys.stderr):
... requests.get('http://httpbin.org/ip')
2011-06-23T21:23:18.422726 GET http://httpbin.org/ip
<Response [200]>
>>> requests.get('http://httpbin.org/ip')
<Response [200]> As an alternative to: >>> requests.settings.verbose=sys.stderr
>>> requests.get('http://httpbin.org/ip')
2011-06-23T21:23:18.422726 GET http://httpbin.org/ip
<Response [200]>
>>> requests.settings.verbose=None
>>> requests.get('http://httpbin.org/ip')
<Response [200]> I love this. Maybe, it would just be best to move proxies into the settings module instead of being required to be passed into each request function for now. |
Decided: current Auth Management still needs to be rethought. |
See #75 for Re: Proxy |
I'd also like to move all non-essential keyword arguments (timeout, proxies, cookies) into a well-documented and constient Closed. |
Use context manager as an alternative way to make requests?
Currently, settings context manager is a singleton. I suspect this will cause multiprocessing issues.
The text was updated successfully, but these errors were encountered: