Skip to content

Instantly share code, notes, and snippets.

@LotusChing
Created November 23, 2016 06:48
Show Gist options
  • Save LotusChing/8b5030f7e1887c4c44c338de63839819 to your computer and use it in GitHub Desktop.
Save LotusChing/8b5030f7e1887c4c44c338de63839819 to your computer and use it in GitHub Desktop.
receive curl upload file to flask
# coding:utf-8
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/upload', methods=['PUT'])
def upload():
with open('test.war', 'wb') as f:
print(dir(request))
f.write(request.data)
return 'OK'
if __name__ == '__main__':
app.run(host='0.0.0.0')
# exmaple cmd: curl -i -X PUT 192.168.0.101:5000/upload --upload-file centos-inital.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment