Reputation: 460
Advise useful python library for work with http with cookies and different methods (GET, POST, etc) like requests.
The main criterions is useful and simplicity. Would very much like to work with library asynchronously by gevent or eventlet.
UPD: I dont want to use requests because it is not work asynchronously: how enable requests async mode?
UPD2: In requests refused urllib2 to urllib3. I think to use urllib2 is bad way. This is not to mention the fact that it is useful.
Upvotes: 0
Views: 513
Reputation: 8846
Requests fully support asynchronous requests.
Here's more information in the docs:
http://docs.python-requests.org/en/latest/user/advanced/#asynchronous-requests
Upvotes: 2
Reputation: 7674
Eventlet and Gevent are both compatible with urllib2 and cookielib, which both depend on the automatically patched socket module and should be able to work with different request methods and cookies.
With eventlet, you only need:
import eventlet
from eventlet.green import urllib2
import cookielib
and with gevent, you only need:
from gevent import monkey; monkey.patch_socket()
import urllib2, cookielib
Those solutions will make both urllib2 and cookielib thread-safe.
Upvotes: 0