Requests: HTTP for Humans¶

Requests: HTTP for Humans — Requests 0.11.1 documentation

Requests: HTTP for Humans

Release v0.11.1. (Installation)

Requests is an ISC Licensed HTTP library, written in Python, for human beings.

Python’s standard urllib2 module provides most of
the HTTP capabilities you need, but the API is thoroughly broken.
It was built for a different time — and a different web. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.

Things shouldn’t be this way. Not in Python.

>>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
>>> r.status_code
204
>>> r.headers['content-type']
'application/json'
>>> r.text
...

See the same code, without Requests.

Requests takes all of the work out of Python HTTP/1.1 — making your integration with web services seamless. There’s no need to manually add query strings to your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic, powered by urllib3, which is embedded within Requests.

原文地址:https://www.cnblogs.com/lexus/p/2429416.html