Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78312 > unrolled thread
| Started by | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| First post | 2014-09-24 22:41 +0200 |
| Last post | 2014-09-24 22:41 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Receiving large files with @tornado.web.stream_request_body Nagy László Zsolt <gandalf@shopzeus.com> - 2014-09-24 22:41 +0200
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
|---|---|
| Date | 2014-09-24 22:41 +0200 |
| Subject | Re: Receiving large files with @tornado.web.stream_request_body |
| Message-ID | <mailman.14332.1411591289.18130.python-list@python.org> |
2014.09.24. 16:31 keltezéssel, Nagy László Zsolt írta:
> @tornado.web.stream_request_body
>> class PostFilesHandler(tornado.web.RequestHandler):
>> def post(self):
>> for postfile in self.request.files:
>> print("File info:",postfile) # There is no
>> postfile["body"] here!!!
>>
>> def prepare(self):
>> self.temp_file = tempfile.NamedTemporaryFile(delete=False)
>>
>> def data_received(self, chunk):
>> self.temp_file.write(chunk) # This is great but which file is
>> this???
>>
>>
> I have found out that the raw post data is stored there. Extracting
> file contents from that raw file is possible. However, the provisional
> email.contentmanager class does not provide methods for extracting
> streams from a mime message. Which is bad, because nobody wants to
> load a huge mime message into memory (for example, a DVD iso file...)
I wrote my own solution in the meantime, that can parse any large POST
request into temporary files without using too much memory. If anyone is
interested I can post it here.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Back to top | Article view | comp.lang.python
csiph-web