Created
January 4, 2018 13:52
-
-
Save danidask/e6ad97fee659062cb5449d96038d1b85 to your computer and use it in GitHub Desktop.
phonk temp sever
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
from flask import Flask, send_from_directory | |
from flask_restful import reqparse, abort, Api, Resource | |
import werkzeug | |
api = Api(app) | |
class AddImage(Resource): | |
def post(self): | |
parse = reqparse.RequestParser() | |
parse.add_argument('userfile', type=werkzeug.datastructures.FileStorage, location='files') | |
args = parse.parse_args() | |
picfile = args['userfile'] | |
picfile.save("pic.png") | |
return {'status': 'ok'} | |
# Api resource routing | |
api.add_resource(AddImage, '/addpic') | |
if __name__ == '__main__': | |
app.run(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment