Question

I receive a Response from the server with the next body:

body='------WebKitFormBoundarylY6hpxLHtLTD33AY\r\nContent-Disposition: form-data; name="file"; filename="language.py"\r\nContent-Type: text/x-python-script\r\n\r\n#!/usr/bin/env python\n
.....
.....
\r\n------WebKitFormBoundarylY6hpxLHtLTD33AY--\r\n'

And I want to parse this body and extract, name, filename, content-type and the full content of the file for storing. May Be possible? Thanks in advance.

Was it helpful?

Solution

Tornado should parse this for you; the contents will be available in self.request.files. http://www.tornadoweb.org/en/stable/httpserver.html#tornado.httpserver.HTTPRequest.files

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top