Skip to content

ashinabraham/starlette-bugsnag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starlette-bugsnag

Bugsnag integration for Starlette ASGI framework.

Installation:

pip install starlette-bugsnag

Usage:

from starlette_bugsnag import BugsnagMiddleware
import bugsnag

bugsnag.configure(...)

app = ...
app = BugsnagMiddleware(app)

Here's a more complete example using Starlette and uvicorn:

import bugsnag
import os
import uvicorn

from starlette_bugsnag import BugsnagMiddleware
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse

bugsnag.configure(api_key=os.getenv('BUGSNAG_API_KEY'), project_root=os.getcwd())

app = Starlette()
app.add_middleware(BugsnagMiddleware, debug=False)


@app.route("/")
def index(request):
    return PlainTextResponse("Hello World")


@app.route("/error")
def raiser(request):
    raise ValueError("This Is an Error")


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)

See examples for more.

About

Bugsnag Error Monitoring Tool Integration for ASGI Frameworks

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages