-
-
Save rizplate/cd6374a8254498ffd0b5c44e55c4c1fa 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