Skip to content

Commit ce93b0b

Browse files
committed
adding step 2
1 parent 7d11d1a commit ce93b0b

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

python-flask-sentry/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==1.1.2
2+
sentry-sdk[flask]==0.15.1

python-flask-sentry/step1/app.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# app.py
2+
from flask import Flask, escape, request
3+
4+
5+
app = Flask(__name__)
6+
7+
8+
@app.route('/divide/<int:numerator>/by/<int:denominator>/')
9+
def hello(numerator, denominator):
10+
answer = numerator / denominator
11+
return f'{numerator} can be divided by {denominator} {answer} times.'

python-flask-sentry/step2/app.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# app.py
2+
import os
3+
import sentry_sdk
4+
from flask import Flask, escape, request
5+
from sentry_sdk.integrations.flask import FlaskIntegration
6+
7+
8+
sentry_sdk.init(
9+
dsn="https://{}.ingest.sentry.io/{}".format(os.getenv('SENTRY_KEY'),
10+
os.getenv('SENTRY_APP_ID')),
11+
integrations=[FlaskIntegration()]
12+
)
13+
14+
15+
app = Flask(__name__)
16+
17+
18+
@app.route('/divide/<int:numerator>/by/<int:denominator>/')
19+
def hello(numerator, denominator):
20+
answer = numerator / denominator
21+
return f'{numerator} can be divided by {denominator} {answer} times.'

0 commit comments

Comments
 (0)