[Twisted-web] [Twisted-Python] http.Request and JSON

Reza Lotun rlotun at gmail.com
Tue Jun 30 12:27:03 EDT 2009


On Tue, Jun 30, 2009 at 4:38 PM, Phil Mayers<p.mayers at imperial.ac.uk> wrote:
> A file-like is a python-esque idiom. You can pass it to all kinds of
> things e.g. JSON parsers, XML parsers.
> What if the body is a 1 gigabyte string? Do you want twisted to read the
> results in from the tempfile, instantiate a python string, and probably
> get killed due to an out-of-memory condition?

Ok, fair enough. I suppose what I was getting at as in general a nicer
way to extract body content. I agree the file-like idiom is pythonic
and probably better overall. I've just seen some annoying debugging
sessions where seek wasn't being performed and reads yielding nothing
- it's rather confusing when you get into that situation. I guess
there's no magic bullet for that.

In fact, I guess the real annoyance stems from the memory of finally
figuring out that the body could be retrieved from request.content *in
the first place* took far too long when I was learning twisted.web.
But that's a different discussion entirely.


Reza Lotun
+44 (0)7521 310 763
rlotun at gmail.com

More information about the Twisted-web mailing list