I wrote this easy program:
@app.route('/puttest/', methods=['GET', 'PUT'])
def upload_file():
if request.method == 'PUT':
return 'Hello, {}!'.format(request.form['name'])
else:
return '''
<title>Does it work ?</title>
<h1>PUT test</h1>
<form action=http://localhost:8887/puttest/ method=put>
<input type=text name=name>
<input type=submit value=try>
</form>
'''
if __name__ == '__main__':
app.run('0.0.0.0', 8887)
It works perfectly for GET
method, but it doesn't work with PUT
. Trying to send put
message, I can see this error at a browser:
Method Not Allowed
The method is not allowed for the requested URL.
What has happened to put
method ?
It will work fine if I change put
method on post
everywhere in program.