Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from paste.httpserver import *
- from webob import *
- from webob.dec import *
- from zipfile import ZipFile
- from tempfile import TemporaryFile
- from pprint import pformat
- form = '''
- <form method=POST action=/ enctype="multipart/form-data">
- <input type=file name=file>
- <input type=submit>
- '''
- @wsgify
- def test_app(req):
- if req.method == 'GET':
- return Response(form)
- f = TemporaryFile()
- z = ZipFile(f, 'w')
- z.writestr('environ.txt', pformat(req.environ))
- z.writestr('wsgi-input.data', req.body_file_raw.read())
- z.close()
- f.seek(0)
- return Response(body_file=f, content_type='application/zip')
- serve(test_app)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement