Which is best in Python: urllib2, PycURL or mechanize?

前端 未结 8 1313
一个人的身影
一个人的身影 2021-01-29 17:48

Ok so I need to download some web pages using Python and did a quick investigation of my options.

Included with Python:

urllib - seems to me that I should use ur

8条回答
  •  有刺的猬
    2021-01-29 18:06

    Don't worry about "last updated". HTTP hasn't changed much in the last few years ;)

    urllib2 is best (as it's inbuilt), then switch to mechanize if you need cookies from Firefox. mechanize can be used as a drop-in replacement for urllib2 - they have similar methods etc. Using Firefox cookies means you can get things from sites (like say StackOverflow) using your personal login credentials. Just be responsible with your number of requests (or you'll get blocked).

    PycURL is for people who need all the low level stuff in libcurl. I would try the other libraries first.

提交回复
热议问题