PagerDuty / pdpyras

Low-level PagerDuty REST/Events API client for Python
MIT License
130 stars 30 forks source link

Uncaught Exception on 500 Error #40

Closed rykener closed 3 years ago

rykener commented 4 years ago

Line 1157 raises an uncaught key error when a 500 is returned, as the request_id is not in the header. https://github.com/PagerDuty/pdpyras/blob/master/pdpyras.py#L1157

The request_id is already available, so this can simply read:

if int(status) == 500:
            self.log.error("PagerDuty API server error (%d)! "
                "For additional diagnostics, contact PagerDuty support "
                "and reference x_request_id=%s / date=%s",
                status, request_id, request_date)

I have a branch ready to go, but i don't have push access to this repo.

Deconstrained commented 3 years ago

Hi @shonin,

Thanks for pointing this out! Easy fix.

Which API endpoint was being requested when this error came up? Our API should respond with this header.

rykener commented 3 years ago

It was the response plays end point, which I see intermittent problems with.