Skip to content

Instantly share code, notes, and snippets.

@f100024
Last active January 22, 2019 13:17
Show Gist options
  • Select an option

  • Save f100024/9f4e3bd3f39f5e709fba5cb36c76a6a0 to your computer and use it in GitHub Desktop.

Select an option

Save f100024/9f4e3bd3f39f5e709fba5cb36c76a6a0 to your computer and use it in GitHub Desktop.
Test Sentry
#!/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