Latest recipes tagged "preprocess"http://code.activestate.com/recipes/tags/preprocess/new/2015-06-30T03:31:31-07:00ActiveState Code RecipesDe-chunk and decompress HTTP body (Python)
2015-06-30T03:31:31-07:00Vovanhttp://code.activestate.com/recipes/users/4192447/http://code.activestate.com/recipes/579075-de-chunk-and-decompress-http-body/
<p style="color: grey">
Python
recipe 579075
by <a href="/recipes/users/4192447/">Vovan</a>
(<a href="/recipes/tags/chunked/">chunked</a>, <a href="/recipes/tags/content/">content</a>, <a href="/recipes/tags/dechunking/">dechunking</a>, <a href="/recipes/tags/decompression/">decompression</a>, <a href="/recipes/tags/encoding/">encoding</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/preprocess/">preprocess</a>, <a href="/recipes/tags/transfer/">transfer</a>).
Revision 2.
</p>
<p>Example read_body_stream() usage:</p>
<pre class="prettyprint"><code>with open(http_file_path, 'rb') as fh:
print(b''.join(httputil.read_body_stream(
fh, chunked=True, compression=httputil.GZIP))
</code></pre>