Created
November 3, 2021 12:27
-
-
Save MachineLearningIsEasy/7eceddc6f3e73922bc2ab34b1112ff68 to your computer and use it in GitHub Desktop.
Flask requests
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 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