Skip to content

Instantly share code, notes, and snippets.

@rmagatti
Last active September 28, 2020 23:28
Show Gist options
  • Select an option

  • Save rmagatti/d0320a6eb25053f2f125b2241a28dd6b to your computer and use it in GitHub Desktop.

Select an option

Save rmagatti/d0320a6eb25053f2f125b2241a28dd6b to your computer and use it in GitHub Desktop.
import requests
import json
import os
import sys
url = "https://sentry.io/api/0/projects/neo-financial/android/events/"
AUTH_TOKEN = os.getenv('SENTRY_TOKEN', None)
if not AUTH_TOKEN:
print("Couldn't grab SENTRY_TOKEN from env var")
sys.exit(1)
headers = {'Authorization':'Bearer {0}'.format(AUTH_TOKEN)}
params = {'full':'true', 'environment':'release', 'cursor':'0:0:0'}
response = requests.get(url, params=params, headers=headers)
content = str(response.content, 'utf-8')
data = json.loads(content)
event_ids = []
issue_ids = []
for d in data:
trace = d['entries'][1]['data']['values'][0].get('rawStacktrace')
if trace:
for frame in trace['frames']:
if frame['absPath']:
if 'BERBIX' in frame['absPath'].upper():
event_ids.append(d['id'])
issue_ids.append(d['groupID'])
distinct_event_ids = list(set(event_ids))
distinct_issue_ids = list(set(issue_ids))
print('event_ids', len(distinct_event_ids), distinct_event_ids)
print('issue_ids', len(distinct_issue_ids), distinct_issue_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment