use  zlib.compressobj

http://docs.python.org/2/library/zlib.html#zlib.compressobj

It will allow you to stream compressed data.

Take note of the compression level.  I found that compression level 1 was
both faster and smaller than the default level for my use cases.


On Thu, Oct 31, 2013 at 3:54 PM, W. Martin Borgert <[email protected]>wrote:

> Hi,
>
> I have large data to transmit in a GET response, so I'm using
> chunked transfer-encoding with yield[1]. This seems to work fine,
> but I also like to gzip compress the data on the fly. This is not
> a problem with complete responses, but I don't get gzip.GzipFile
> to work with chunked data. Does anybody know how to achieve this?
>
> TIA!
>
> [1] http://webpy.org/cookbook/streaming_large_files
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/webpy.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to