URLLIB2 is a good HTTP access library, but the design of the API is too rational, resulting in human use of this organism will encounter a variety of complex headaches.
Requests's witty and interesting introduction is as follows:
Requests is the only non-GMO Python HTTP Library that humans can enjoy safely.
warning : Non-professional use of other HTTP libraries can lead to dangerous side effects, including: security defects, redundant code, Reinventing wheel disease, chewing on documents, depression, headaches, and even death.
Requests Chinese documents
A simple example of a requests module
Import= requests.get ('http://www.bing.com')# The text of the HTML document after transcoding response_text = response.text# The original text of the HTML document (bytes object)Response_text = Response.content
This is just the tip of the iceberg of this module, powerful but not complex, is indeed a good design module, so want to go deeper, documentation and practice is the quickest way.
* requests + BeautifulSoup work together is refreshing, if you are also in for HTTP access and HTML parsing headache or annoyance, may wish to look at these two modules of the documentation, there will be a lot of gains.
Python module--requests