PagerDuty / pdpyras

Low-level PagerDuty REST/Events API client for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Iteration fails for retrieving PagerDuty response plays

defiant214 opened this issue · comments

Receive TypeError when doing the following

>>> rp = list(session.iter_all("response_plays"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Users\[user]\AppData\Local\Programs\Python\Python39\lib\site-packages\pdpyras.py", line 1058, in iter_all
    offset += data['limit']
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' ```

Same error occurs with list_all and dict_all. Able to receive list via rget method only

Cool; thanks for pointing this out.

The response plays API is returning null values for limit and offset in the body, which is not expected. So, in other words, this is a bug in the API itself. I've submitted a ticket to the appropriate team that owns this API.

For context: the client by design sets the limit to the limit returned by the API (if it's present in the response body) and increments the offset by that limit if the limit is present in the response. That is for cases where the requested limit is greater than the maximum limit. This prevents incrementing offset by more than the actual page size, so that records won't be skipped over.

Backwards-compatible workaround implemented in 4.2.1