cleanup #676
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kenneth Reitz · committed by Kenneth Reitz · parent 511b139 · Browse files · 1 file·+4 added−51 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+4 added−51 removed
- other:+4 added−51 removed
Provenance
- Commit
6b1e81c- Tree
fa451dc- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent
511b139
1 file changed+4 added−51 removed
modified:docs/user/advanced.rst+4 added-51 removed
49 unmodified lines50 51 Whenever a call is made to requests.*() you are doing two major things. First,52 you are constructing a ``Request`` object which will be sent of to a server53 to request or query some resource. Second, a ``Response`` object is generated54-once ``requests`` gets a response back from the server. The response object 54+once ``requests`` gets a response back from the server. The response object55 contains all of the information returned by the server and also contains the56 ``Request`` object you created originally. Here is a simple request to get some57 very important information from Wikipedia's servers::58- 58+59 >>> response = requests.get('http://en.wikipedia.org/wiki/Monty_Python')60 61 If we want to access the headers the server sent back to us, we do this::62- 62+63 >>> response.headers64 {'content-length': '56170', 'x-content-type-options': 'nosniff', 'x-cache':65- 'HIT from cp1006.eqiad.wmnet, MISS from cp1010.eqiad.wmnet', 'content-encoding': 65+ 'HIT from cp1006.eqiad.wmnet, MISS from cp1010.eqiad.wmnet', 'content-encoding':66 'gzip', 'age': '3080', 'content-language': 'en', 'vary': 'Accept-Encoding,Cookie',67 'server': 'Apache', 'last-modified': 'Wed, 13 Jun 2012 01:33:50 GMT',68 'connection': 'close', 'cache-control': 'private, s-maxage=0, max-age=0,69 must-revalidate', 'date': 'Thu, 14 Jun 2012 12:59:39 GMT', 'content-type':6 unmodified lines76 >>> response.request.headers77 {'Accept-Encoding': 'identity, deflate, compress, gzip',78 'Accept': '*/*', 'User-Agent': 'python-requests/0.13.1'}79 80-Requests have these attributes:80 82- * Variable Attributes83- * allow_redirects84- * auth85- * cert86- * config87- * cookies88- * data89- * files90- * headers91- * hooks92- * method93- * params94- * prefetch95- * proxies96- * redirect97- * response98- * sent99- * session100- * timeout101- * url102- * Class Methods103- * deregister_hook104- * full_url105- * path_url106- * register_hook107- * send108-109-Responses have the following attributes:110-111- * Variable Attributes112- * config113- * cookies114- * encoding115- * error116- * headers117- * history118- * raw119- * request120- * status_code121- * url122- * Class Methods123- * content124- * json125- * raise_for_status126- * text127-81 SSL Cert Verification82 ---------------------83 84 Requests can verify SSL certificates for HTTPS requests, just like a web browser. To check a host's SSL certificate, you can use the ``verify`` argument::400 unmodified lines