Last active
January 11, 2021 17:47
-
-
Save lvisintini/c1910687d3d56a6c194e026c012b0054 to your computer and use it in GitHub Desktop.
Collect data fro issues in Sentry
This file contains 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
# Docs: | |
# - https://docs.sentry.io/api/ | |
# - https://github.com/allisson/python-simple-sentry-client | |
# - https://github.com/allisson/python-simple-rest-client | |
# - https://python-simple-rest-client.readthedocs.io/en/latest/ | |
from simple_sentry_client.api import get_api_instance | |
AUTH_TOKEN = '<your auth token here>' # get one from https://sentry.io/settings/account/api/auth-tokens/ whilst logged in | |
ISSUE_ID = <your issue id here> # integer; the URL for the issue in sentry should contain this value | |
per_page = 50 | |
api = get_api_instance(AUTH_TOKEN, timeout=30) | |
events = [] | |
ids = set() | |
cursor = "0:0:1" | |
while cursor is not None: | |
print(cursor) | |
params = {"cursor": cursor, "full": True, "per_page": per_page} | |
response = api.issues.events(ISSUE_ID, params=params) | |
events.extend(response.body) | |
for e in response.body: | |
ids.add(e['id']) | |
if 'results="true"' in response.headers.get("link").split(',')[1]: | |
cursor = response.headers.get("link").split(',')[1].split('cursor="')[1].strip('"') | |
else: | |
cursor = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment