How can I speed up fetching pages with urllib2 in python?

后端 未结 11 1169
野的像风
野的像风 2020-11-28 03:28

I have a script that fetches several web pages and parses the info.

(An example can be seen at http://bluedevilbooks.com/search/?DEPT=MATH&CLASS=103&SEC=01 )

11条回答
  •  野性不改
    2020-11-28 03:41

    Nowadays there is excellent Python lib that do this for you called requests.

    Use standard api of requests if you want solution based on threads or async api (using gevent under the hood) if you want solution based on non-blocking IO.

提交回复
热议问题