Skip to content
Snippets Groups Projects

Resolve "matchSalamander endpoint"

Merged Herman Andersen Dyrkorn requested to merge 1-matchsalamander-endpoint into master
+ 17
10
# This is a sample Python script.
import os
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
from flask import Flask, request
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
class MatchSalamander(Resource):
@staticmethod
def post():
data = request.form
uploaded_file = request.files['image']
if uploaded_file.filename != '':
uploaded_file.save("images/"+uploaded_file.filename)
return {"species:": data["species"], "sex": data["sex"], "location": data["location"]}
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
api.add_resource(MatchSalamander, "/matchSalamander")
if __name__ == "__main__":
app.run(debug=True)
Loading