Been trialing sentry within my project to replace our old, ugly error handler and im trying to return the JSON data of every event that is caught and sent to a specific environment in the sentry dashboard.
. Currently my code looks like this:
def get_event(id):
headers = {
"Authorization": f"Bearer {sentry_token}",
}
url = f"https://sentry.io/api/0/projects/{org_slug}/{project_slug}/events/?environment={environment}&eventID={id}"
print(url)
response = requests.get(url=url, headers=headers)
where {id} the the event id of the error that is being raised.
However, when I print the response it is returning the JSON data of every single event that has happened within the specified sentry envrionment, except for the event who's ID I have specified in the url (that event doesn't get displayed until I have created a new one and run the code again for some reason).
Is there any way to only have it return the one event that is being caught?
the flow of my code looks like:
try:
int("asdas")
except Exception as e:
id = sentry.capture_exception(e)
get_event(id)
Thanks