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
Improved Error Handling #22
Conversation
Fixed minor bug where spawn was being called twice
This seems like a logical way to handle things. I need to think about it further though :) |
+1 on better error/exception handling as right now there's no easy way to suppress it |
And a +1 from me also. At the moment I'm struggling with timeout error issues, as so. # pip install cython==0.19.1
# pip install -e git://github.com/surfly/gevent.git@1.0rc2#egg=gevent
# pip install requests==1.2.1
# pip install grequests==0.2.0
import grequests
url = 'http://httpbin.org/delay/'
rs = (grequests.get('{0}{1}'.format(url, d), timeout=4) for d in (2, 4, 6))
for r in grequests.imap(rs, size=3):
if r.ok:
print r.url . Traceback (most recent call last):
File "/home/dave/.virtualenvs/newgevent/src/gevent/gevent/greenlet.py", line 328, in run
result = self._run(*self.args, **self.kwargs)
File "/home/dave/.virtualenvs/newgevent/local/lib/python2.7/site-packages/grequests.py", line 128, in send
return r.send(stream=stream)
File "/home/dave/.virtualenvs/newgevent/local/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/dave/.virtualenvs/newgevent/local/lib/python2.7/site-packages/requests/sessions.py", line 347, in request
resp = self.send(prep, **send_kwargs)
File "/home/dave/.virtualenvs/newgevent/local/lib/python2.7/site-packages/requests/sessions.py", line 450, in send
r = adapter.send(request, **kwargs)
File "/home/dave/.virtualenvs/newgevent/local/lib/python2.7/site-packages/requests/adapters.py", line 333, in send
raise Timeout(e)
Timeout: HTTPConnectionPool(host='httpbin.org', port=80): Request timed out. (timeout=4)
<Greenlet at 0x2c842d0: send(<grequests.AsyncRequest object at 0x2caa090>)> failed with Timeout |
Any update? |
Bump! This would be super helpful. |
+1 |
https://github.com/saghul/erequests now supports error handling |
+1 |
2 similar comments
+1 |
+1 |
#yolo |
@brendoncrawford can you rebase, and add some docs? |
+1 for a way to handle exceptions raised within grequests. |
+1 |
Hey, would you like it if I rebased it and created a new pull request and added some docs? I can't merge changes into this pull request though, I don't think. |
That would be terrific, thanks for offering to do that!
|
Hi there, I've tried to merge, but there have been to many changes for me to succeed in that rebase. Furthermore, there are 3 other pull requests similar to this one, sitting open :\ |
@droope - I'm not familiar enough with this code to try and evaluate the merits of the various pull requests and merge them myself, or I'd jump in at this point. I'm not sure what the other interim changesets are, but I may just fork from a previous revision where your patch is compatible and merge it in since this is the main changeset that I know that I need right now. I'm sure the other improvements are great, but until I know I need them, I'm not sure that they're going to help me. It's been almost two years since this issue was first identified, and I can't imagine how everyone else who uses this library doesn't need it as well. In almost any realistic scenario, it seems that you need to handle those exceptions. |
hi @ptwobrussell, it's not my patch though, I was trying to merge it but it was originally created by @brendoncrawford I agree with you regarding how essential these patches are. I've personally migrated to requests-futures, since that has error handling. and @kennethreitz (the author of this library) considers futures the way to go (#10) Also, performance-wise, I've found the other library to be equal in speed or slightly faster, and doesn't require for every user of your application to compile gevent |
@droope - Thanks for pointing me to https://github.com/ross/requests-futures This looks great, and I wasn't yet aware of it. I'll take a look and see if I can't get moving with it. Really appreciate the link... |
Resubmitting this due to a mistake I made in the branching. This builds off of this pull request here, so you will not want to merge both:
#15