Last active
January 22, 2019 13:17
-
-
Save f100024/9f4e3bd3f39f5e709fba5cb36c76a6a0 to your computer and use it in GitHub Desktop.
Test Sentry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # How to test sentry. | |
| # pip install --upgrade pip requests raven | |
| from raven import Client | |
| from raven.transport.requests import RequestsHTTPTransport | |
| import requests | |
| import logging | |
| sentry_errors_log = logging.getLogger("sentry.errors") | |
| sentry_errors_log.addHandler(logging.StreamHandler()) | |
| SENTRY_DSN = 'https://public_key:secret_key@sentry.io/3' | |
| SENTRY_TRANSPORT = RequestsHTTPTransport | |
| client = Client(SENTRY_DSN, transport=SENTRY_TRANSPORT) | |
| try: | |
| 1 / 0 | |
| except ZeroDivisionError: | |
| client.captureException() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment