I was trying to create a minimal flask server/client python movie file uploader but my client-code doesn't seem to be working properly and I'm wondering if I need more then what I have?
Server.py
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST', 'PUT'])
def hello_world():
file = request.files
return(str(file))
running as: flask run
Uploader.py
import requests
files = {'file': open("BigBuckBunny_320x180.mp4")}
r = requests.post("http://127.0.0.1:5000/", files)
print(r.text)
running as: python Uploader.py
However the hello_world
method returns ImmutableMultiDict([])
For Debugging purposes I've used this following curl snippet which seems to work:
curl -i -X PUT -F filedata=@BigBuckBunny_320x180.mp4 "http://localhost:5000/"
and returns
ImmutableMultiDict([('file', <FileStorage: u'BigBuckBunny_320x180.mp4' ('application/octet-stream')>)])
Any Idea why the Uploader.py
fails?