Skip to content

Instantly share code, notes, and snippets.

@kevincdurand1
Created May 22, 2018 02:28
Show Gist options
  • Select an option

  • Save kevincdurand1/c9b4cc0ce929b73db0a5ef97c7f46040 to your computer and use it in GitHub Desktop.

Select an option

Save kevincdurand1/c9b4cc0ce929b73db0a5ef97c7f46040 to your computer and use it in GitHub Desktop.
Create a Web API with Flask.py
from flask import *
app = Flask(__name__)
@app.route('/post', methods = ['POST'])
def post():
json = request.json
encoded = request.form
cp1_ = (encoded.get("cp1"))
cp2_ = (encoded.get("cp2"))
cp3_ = (encoded.get("cp3"))
cp4_ = (encoded.get("cp4"))
cp5_ = (encoded.get("cp5"))
print(float(cp1_)*2)
result = cp1_
return result
# Run
if __name__ == '__main__':
app.run(
host = "localhost",
port = 8080
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment