This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from flask import Flask, request | ||
app = Flask(__name__) | ||
|
||
@app.route('/hello', methods=['POST']) | ||
def hello_world(): | ||
"""Responds to any HTTP request. | ||
Args: | ||
request (flask.Request): HTTP request object. | ||
Returns: | ||
The response text or any set of values that can be turned into a | ||
Response object using | ||
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`. | ||
""" | ||
request_json = request.get_json() | ||
if request.args and 'message' in request.args: | ||
return request.args.get('message') | ||
elif request_json and 'message' in request_json: | ||
return request_json['message'] | ||
else: | ||
return f'Hello World2!' |