mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
fixed typo, clarified how to check for compressed content
This commit is contained in:
@@ -477,7 +477,7 @@ reply: 'HTTP/1.1 200 OK'</samp>
|
||||
<mark> 'etag': '"7f806d-1a01-9fb97900"',</mark>
|
||||
<mark> 'last-modified': 'Tue, 02 Jun 2009 02:51:48 GMT',</mark>
|
||||
'server': 'Apache',
|
||||
'status': '304',
|
||||
'status': '200',
|
||||
'vary': 'Accept-Encoding,User-Agent'}</samp>
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>len(content)</kbd> <span class=u>③</span></a>
|
||||
<samp class=pp>6657</samp></pre>
|
||||
@@ -544,7 +544,7 @@ reply: 'HTTP/1.1 200 OK'</samp>
|
||||
'vary': 'Accept-Encoding,User-Agent'}</samp></pre>
|
||||
<ol>
|
||||
<li>Every time <code>httplib2</code> sends a request, it includes an <code>Accept-Encoding</code> header to tell the server that it can handle either <code>deflate</code> or <code>gzip</code> compression.
|
||||
<li>In this case, the server has responded with a gzip-compressed payload. By the time the <code>request()</code> method returns, <code>httplib2</code> has already decompressed the body of the response and placed it in the <var>content</var> variable. If you’re curious about whether or not the response was compressed, you can check the <var>response</var> dictionary; otherwise, don’t worry about it.
|
||||
<li>In this case, the server has responded with a gzip-compressed payload. By the time the <code>request()</code> method returns, <code>httplib2</code> has already decompressed the body of the response and placed it in the <var>content</var> variable. If you’re curious about whether or not the response was compressed, you can check <var>response['-content-encoding']</var>; otherwise, don’t worry about it.
|
||||
</ol>
|
||||
|
||||
<h3 id=httplib2-redirects>How <code>httplib2</code> Handles Redirects</h3>
|
||||
|
||||
Reference in New Issue
Block a user