How do I pass compressed data using the Task Queue Python API in App Engine?

Instead of using params, use payload, which includes your data in the body of the request, unencoded. Then you can use zlib. Decompress(self.request.

Body) to retrieve the data.

Oh... duh! :) Thanks, Nick! – Ivan Jan 29 '10 at 17:11.

Read the docs... (my emphasis! ): params Dictionary of parameters to use for this Task. Values in the dictionary may be iterable to indicate repeated parameters.

May not be specified for a POST request if payload is already specified. For POST requests, these params will be encoded as 'application/x-www-form-urlencoded' and set to the payload; for all other methods, the parameters will be converted to a query string. May not be specified if the URL already contains a query string and the method is GET.Zlib.

Compress produces an arbitrary string of bytes... but then query-string conversion interprets it as Unicode! So, use any 1-byte codec, such as latin-1, to . Encode the compressed results in order to pass (what's actually a binary) bytestring of params, and the same codec for a .

Decode to get back from the "unicode" string to a string of bytes that you can decompress. Phew... you sure the compression is crucial enough to your app's performance to be worth this weird set of gyrations, or wouldn't it be better to eschew it? -).

Thanks, Alex! I'm basically passing a fetched chunk of html to a handler to parse and process. I have to use compression to keep the Task object under 10KB.

I guess I could store the HTML in the Datastore and then pass a key to the handler instead, but that seems wasteful of quota for now. – Ivan Jan 29 '10 at 17:11.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions