Skip to content

Instantly share code, notes, and snippets.

@MachineLearningIsEasy
Created November 3, 2021 12:27
Show Gist options
  • Save MachineLearningIsEasy/7eceddc6f3e73922bc2ab34b1112ff68 to your computer and use it in GitHub Desktop.
Save MachineLearningIsEasy/7eceddc6f3e73922bc2ab34b1112ff68 to your computer and use it in GitHub Desktop.
Flask requests
from flask import request, Flask
import json
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def main_flask_function():
if request.method == 'POST':
print(json.loads(request.data))
return 'You sent post request'
else:
return 'You sent get request'
if __name__ == '__main__':
app.run(host='0.0.0.0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment