user12397901
user12397901

Reputation: 460

python - advise library like requests

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

Answers (3)

Kenneth Reitz
Kenneth Reitz

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

enderskill
enderskill

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

Tre Jones
Tre Jones

Reputation: 61

Have you looked at cookielib?

Upvotes: 0

Related Questions