Created
May 22, 2018 02:28
-
-
Save kevincdurand1/c9b4cc0ce929b73db0a5ef97c7f46040 to your computer and use it in GitHub Desktop.
Create a Web API with Flask.py
This file contains hidden or 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 * | |
| 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