Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78290

Re: Receiving large files with @tornado.web.stream_request_body

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.084
X-Spam-Evidence '*H*': 0.83; '*S*': 0.00; 'clean.': 0.09; 'subject:files': 0.09; 'def': 0.12; 'stored': 0.12; 'mailscanner,': 0.16; 'skip:p 40': 0.19; 'memory': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'post': 0.26; '(for': 0.26; 'header:In-Reply-To:1': 0.27; 'scanned': 0.29; 'file': 0.32; 'class': 0.32; 'there.': 0.32; 'raw': 0.33; 'skip:t 40': 0.33; 'message.': 0.35; 'subject:with': 0.35; 'possible.': 0.35; 'but': 0.35; 'there': 0.35; 'believed': 0.36; 'example,': 0.37; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'dangerous': 0.60; 'viruses': 0.61; 'provide': 0.64; 'great': 0.65; 'nobody': 0.68; 'dvd': 0.78; 'streams': 0.84
Date Wed, 24 Sep 2014 16:31:28 +0200
From Nagy László Zsolt <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Receiving large files with @tornado.web.stream_request_body
References <5422BB11.40001@shopzeus.com>
In-Reply-To <5422BB11.40001@shopzeus.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-shopzeus-MailScanner-Information Please contact the ISP for more information
X-shopzeus-MailScanner-ID 934B08897398.AD9D3
X-shopzeus-MailScanner Found to be clean
X-shopzeus-MailScanner-From gandalf@shopzeus.com
X-Spam-Status No
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14316.1411569091.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1411569091 news.xs4all.nl 2942 [2001:888:2000:d::a6]:33065
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78290

Show key headers only | View raw


@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...)



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Receiving large files with @tornado.web.stream_request_body Nagy László Zsolt <gandalf@shopzeus.com> - 2014-09-24 16:31 +0200

csiph-web