https://github.com/facebook/tornado/blob/master/tornado/httpclient.py
Best
Daniel
Did you mean https://github.com/facebook/tornado/blob/master/tornado/curl_httpclient.py
?
This shows how to make pycurl use Tornado's event loop. It should not be
hard to modify it to run on gevent's loop instead, see
https://github.com/wil/gtornado
Next step is to wrap the resulting async API with sync "green" API,
which is also not hard at all.
Then you can monkey patch whatever library uses pycurl with "green" pycurl.
I did it here: https://bitbucket.org/denis/gevent-curl/
geventcurl.Curl() object wraps pycurl.Curl, however its perform()
method actually uses a CurlMulti instance.
Here's an example:
https://bitbucket.org/denis/gevent-curl/src/d9aeccd324b8/example.py
Unfortunately, my version of pycurl (7.19.0-3build1), which appears to
be the latest, seems to leak Python references (sys.gettotalrefcount()
is constantly increasing) when CurlMulti interface is used.
So if you are going to use pycurl, does not matter with Tornado or
Gevent, you should look into fixing that first.