Python Errbit Reporter
A client for reporting exceptions to errbit.
Installation
pip install errbit_reporter
Usage
import errbit_reporter as errbit
config = errbit.Configuration(
api_key='491b8cbb777b051df1406ae0bcdbee2c',
errbit_url='http://errbit.yourserver.com')
client = errbit.Client(config)
with client.notify_on_exception():
your_code_here()
To avoid sending exceptions in development, just use None for the errbit_url. For example:
config = errbit.Configuration(
api_key='491b8cbb777b051df1406ae0bcdbee2c',
errbit_url=None,
environment_name='development')
Additional context can be provided for the error. For example:
context = {
'request_url': 'http://example.com/account/signup',
'component': 'AccountController',
'action': 'signup',
'params': {
'user': {
'name': 'dylan'
}
},
'cgi_data': {
'REQUEST_METHOD': 'POST',
'HTTP_USER_AGENT': 'curl'
},
'session' {
'session_id': '6df95c0296cee016fb672af9310667e24dca066909a723dd6439369bb82911f3'
}
}
with client.notify_on_exception(**context):
your_code_here()
A notice can also be sent without a context manager to get notice metadata which can be used to log the errbit notice url.
try:
your_code_here()
except:
notice_metadata = client.notify()
print(notice_metadata.url)
By default the exception information is taken from sys.exc_info(), but exc_info can also be passed as the first parameter, and additional context can be provided using the same keyword arguments as notify_on_exception.
In a distributed system (e.g. Spark) it is useful to be able to specify the backtrace manually. For example, this the backtrace could consist of local and remote processes stack trace, even if the remote processes is written in another language.
exc_type, exc_value, exc_traceback = sys.exc_info()
backtrace = traceback.extract_tb(exc_traceback)
notice = errbit.Notice(config, exc_type.__name__, str(exc_value), backtrace)
client.send_notice(notice)
Test Suite
make test
Copyright
Copyright (c) 2014 “Shopify Inc.”. See LICENSE for details.
Metadata
Release files for errbit-reporter 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| errbit-reporter-0.0.3.tar.gz | 5.7 kB | Without provenance | Details for errbit-reporter-0.0.3.tar.gz |
Release files / errbit-reporter-0.0.3.tar.gz
| Download URL | errbit-reporter-0.0.3.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7cb73063fc52a99902f03f3ecec206146f5883b303656ed2bd6d4c5f8eef9ff
|
|
BLAKE2b-256 checksum How to use checksums |
8b015c4806c44106a08628d2b9f85c65d1c370a233fdb326d098fc6ef1619b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for errbit-reporter 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.