Python urllib3 and how to handle cookie support?

后端 未结 5 891
野趣味
野趣味 2020-12-06 16:55

So I\'m looking into urllib3 because it has connection pooling and is thread safe (so performance is better, especially for crawling), but the documentation is... minimal to

5条回答
  •  不思量自难忘°
    2020-12-06 17:41

    You should use the requests library. It uses urllib3 but makes things like adding cookies trivial.

    https://github.com/kennethreitz/requests

    import requests
    r1 = requests.get(url, cookies={'somename':'somevalue'})
    print(r1.content)
    

提交回复
热议问题