-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (28 loc) · 993 Bytes
/
main.py
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
import os
import apprise
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
name = os.environ.get("NAME", "World")
apobj = apprise.Apprise()
apobj.add('sendgrid://SENDGRIDTOKENHERE:isaac@freshbrewed.science/isaac.johnson@gmail.com')
apobj.add('msteams://MSTEAMSTOKENHERE')
apobj.notify(
body='Notified by Cloud Run Function',
title='From Python Cloud Run',
)
return "Hello hello {}!".format(name)
@app.route("/asdf1234")
def hello_world2():
name = os.environ.get("NAME", "World")
apobj = apprise.Apprise()
apobj.add('sendgrid://SENDGRIDTOKENHERE:isaac@freshbrewed.science/isaac.johnson@gmail.com')
apobj.add('msteams://MSTEAMSTOKENHERE')
apobj.notify(
body='Notified by Cloud Run Function',
title='From Python Cloud Run',
)
return "Hello hello {}!".format(name)
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))