-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
42 lines (32 loc) · 1.12 KB
/
app.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
35
36
37
38
39
40
41
42
import logging
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from flask import Flask, request, redirect
from utils.SpreadSheet import DoctorSheet
from utils.credentials import SENTRY_URL
app = Flask(__name__)
# All of this is already happening by default!
sentry_logging = LoggingIntegration(
level=logging.INFO, # Capture info and above as breadcrumbs
event_level=logging.ERROR # Send errors as events
)
sentry_sdk.init(
dsn=SENTRY_URL,
integrations=[FlaskIntegration(), sentry_logging],
traces_sample_rate=1.0
)
@app.route('/close_ticket')
def hello_world():
dSheet = DoctorSheet()
user_id = dSheet.close_ticket(request.args.get('ticket_uuid'))
if request.user_agent.platform in ['ipad', 'iphone']:
return redirect(f'twitter://messages/compose?recipient_id={user_id}')
return redirect(f'https://twitter.com/messages/compose?recipient_id={user_id}')
@app.route('/fuck-afk')
def hello():
dSheet = DoctorSheet()
dSheet.afk()
return "OK"
if __name__ == '__main__':
app.run()