Created
December 14, 2018 18:48
-
-
Save PandaWhoCodes/91e70afcf4df90e0958f7081ca8d1b2f to your computer and use it in GitHub Desktop.
The following snippet creates an API to recieve 2 numbers and return their sum.
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 Flask, request | |
app = Flask(__name__) | |
@app.route('/', methods=['GET']) | |
def add(): | |
num1 = request.args.get('num1') | |
num2 = request.args.get('num2') | |
return num1 + num2 | |
if __name__ == "__main__": | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment