Stuck at Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']

13 views
Skip to first unread message

Vinay Joseph via StackOverflow

unread,
May 17, 2017, 10:43:07 AM5/17/17
to google-appengin...@googlegroups.com

I have written a Flask app to upload an image file. The route is as follows

@app.route('/upload', methods=['POST'])
def upload_files():
    if 'file' in request.files:
        filename = request.files['file']
        filename.save('images/uploaded.jpg')
        return 'Uploaded'
    else:
        return 'Not uploaded'

I am testing this route using the following file.

import requests

url = 'http://localhost:8080/upload'
files = {'file':open('pexels.jpg','rw')}

r = requests.post(url, files=files)
print(r.text)

When I run the test I get the following Warning and it gets stuck.

WARNING  2017-05-17 14:37:11,214 urlfetch_stub.py:534] Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/44027983/stuck-at-stripped-prohibited-headers-from-urlfetch-request-host-content-le
Reply all
Reply to author
Forward
0 new messages