Created
November 23, 2016 06:48
-
-
Save LotusChing/8b5030f7e1887c4c44c338de63839819 to your computer and use it in GitHub Desktop.
receive curl upload file to flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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