Skip to content

Instantly share code, notes, and snippets.

@PandaWhoCodes
Created December 14, 2018 18:48
Show Gist options
  • Save PandaWhoCodes/91e70afcf4df90e0958f7081ca8d1b2f to your computer and use it in GitHub Desktop.
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.
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