Add sentry middleware for ASGI
This commit is contained in:
parent
17f5a462fe
commit
3b6c604d85
3 changed files with 11 additions and 1 deletions
1
Pipfile
1
Pipfile
|
@ -35,3 +35,4 @@ python-dateutil = "==2.8.0"
|
||||||
starlette = "==0.12.9"
|
starlette = "==0.12.9"
|
||||||
uvicorn = "==0.8.6"
|
uvicorn = "==0.8.6"
|
||||||
starlette-auth-toolkit = "==0.5.0"
|
starlette-auth-toolkit = "==0.5.0"
|
||||||
|
sentry-asgi = "==0.2.0"
|
||||||
|
|
9
Pipfile.lock
generated
9
Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "0e4b536511730008f5acfed1fc87a219976efc3ff233583edb362befe854f00e"
|
"sha256": "1b18f00a22630052a4574e27d066214fbf4dee101c5c918d787e7850c3d28141"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -108,6 +108,13 @@
|
||||||
],
|
],
|
||||||
"version": "==2.22.0"
|
"version": "==2.22.0"
|
||||||
},
|
},
|
||||||
|
"sentry-asgi": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0fc35fc6da9c16c0353f087c29fcfcd694b767bd1a77a2e768f519618eb3defd"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.2.0"
|
||||||
|
},
|
||||||
"sentry-sdk": {
|
"sentry-sdk": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:528f936118679e9a52dacb96bfefe20acb5d63e0797856c64a582cc3c2bc1f9e",
|
"sha256:528f936118679e9a52dacb96bfefe20acb5d63e0797856c64a582cc3c2bc1f9e",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
from sentry_asgi import SentryMiddleware
|
||||||
from starlette.applications import Starlette
|
from starlette.applications import Starlette
|
||||||
from starlette.authentication import SimpleUser, requires # or a custom user model
|
from starlette.authentication import SimpleUser, requires # or a custom user model
|
||||||
from starlette.middleware.authentication import AuthenticationMiddleware
|
from starlette.middleware.authentication import AuthenticationMiddleware
|
||||||
|
@ -29,6 +30,7 @@ def get_server():
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
app.add_middleware(AuthenticationMiddleware, backend=BasicAuth())
|
app.add_middleware(AuthenticationMiddleware, backend=BasicAuth())
|
||||||
|
app.add_middleware(SentryMiddleware)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
Reference in a new issue