Skip to content
Myr

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

1 file+4 added−51 removed

modified:docs/user/advanced.rst+4 added-51 removed
49 unmodified lines
5051Whenever a call is made to requests.*() you are doing two major things. First,52you are constructing a ``Request`` object which will be sent of to a server53to request or query some resource. Second, a ``Response`` object is generated54once ``requests`` gets a response back from the server. The response object 54once ``requests`` gets a response back from the server. The response object55contains all of the information returned by the server and also contains the56``Request`` object you created originally. Here is a simple request to get some57very important information from Wikipedia's servers::58 5859 >>> response = requests.get('http://en.wikipedia.org/wiki/Monty_Python')6061If we want to access the headers the server sent back to us, we do this::62 6263 >>> 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 lines
76 >>> response.request.headers77 {'Accept-Encoding': 'identity, deflate, compress, gzip',78 'Accept': '*/*', 'User-Agent': 'python-requests/0.13.1'}7980Requests have these attributes:8082 * 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 * send108109Responses have the following attributes:110111 * Variable Attributes112 * config113 * cookies114 * encoding115 * error116 * headers117 * history118 * raw119 * request120 * status_code121 * url122 * Class Methods123 * content124 * json125 * raise_for_status126 * text12781SSL Cert Verification82---------------------8384Requests 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