-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmy_app.py
More file actions
38 lines (25 loc) · 702 Bytes
/
Copy pathmy_app.py
File metadata and controls
38 lines (25 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import datetime
import logging
import os
from flask import Flask, request
logger = logging.getLogger()
logger.setLevel(logging.INFO)
app = Flask(__name__)
@app.route("/", methods=['GET'])
def index():
return "hello world"
@app.route("/status", methods=['POST'])
def status():
name = request.form.get("name")
status = request.form.get("status")
return (f"hi {name}, it's {status}!")
@app.route("/envvar", methods=['GET'])
def envvar():
return os.environ["ENV_VAR_1"]
def scheduled():
mydatetime = datetime.datetime.utcnow()
mystring = (f"schedule triggered on {mydatetime}")
logger.info(mystring)
return mystring
if __name__ == "__main__":
app.run()