-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError when using rget/rput/rpost/list_all for EventOrchestrations API #96
Comments
This is a known issue: https://pagerduty.github.io/pdpyras/#list-of-non-conformal-endpoints |
Keeping this open; there may be a compromise that does not require an abstraction layer for resource types (which is not the intent of design) but enables the convenience methods to be used with the newer endpoints. With some of the newer APIs, the envelope name is the only major departure from the conventions that were once universal. Such APIs could be accommodated without cluttering the codebase with special exceptions and workarounds. |
This may take a while and in the end I might decide on leaving this as-is. There are a lot of endpoints I need to review in order to decide on a design for a whole new level of abstraction to handle non-conformal APIs, and even then, future APIs might break assumptions that are safe to make for all the current APIs. Some endpoints like |
It's coming along nicely. It's going to be a new major release. All current endpoints will be supported, although entity wrapping won't always be enabled. I'm developing a rubric for determining when it is enabled based on the endpoint. This won't completely eliminate the need to check the documentation of a given API before using it, but it will do away with the extreme rigidity and usability landmine of having supported vs non-conformal endpoints with respect to entity wrapping. |
There is an assumption in
resource_envelope
used for rget/rpost/rput and list_all functions that the name of the resource provided in the url path is the same as the name of the resource that comes back in the API response:https://github.com/PagerDuty/pdpyras/blob/main/pdpyras.py#L127
https://github.com/PagerDuty/pdpyras/blob/main/pdpyras.py#L1138
However this doesn't always seem to be the case. For the event orchestrations APIs, the url path is
/event_orchestrations
and the response contains"orchestrations"
or"orchestration_path"
for the router/unrouted/service APIshttps://developer.pagerduty.com/api-reference/7ba0fe7bdb26a-list-event-orchestrations
so the result of
list_all
is a KeyError at pdpyras.py:1187KeyError: 'event_orchestrations'
The text was updated successfully, but these errors were encountered: