PagerDuty / pdpyras

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

Pydras 5.0 throws an error when accessing oncall API #102

Closed alexeiser closed 1 year ago

alexeiser commented 1 year ago

On python 3.10 https://github.com/PagerDuty/pdpyras/blob/main/pdpyras.py#LL787C1-L790C26 Throws an TypeError: not enough arguments for format string error, because no variable is available to be inserted. Suggest rewriting like

        return (
            f"{endpoint}: Success (status {r.status_code}) but an expectation still " \
            f"failed{context_msg}"
        )

This happens when using the paged request for oncall. e.g.

    user_params = {
        "time_zone": TZ_NAME,
        "since": ts["start"].isoformat(),
        "until": ts["end"].isoformat(),
    }

    oncalls = session.iter_all(
        "oncalls", params=user_params, page_size=MAX_ITEMS)
    final_report_rows = {}
    for o in oncalls:
av1m commented 1 year ago

I open a PR #103. Check https://github.com/PagerDuty/pdpyras/pull/103, it seems to be the same problem

alexeiser commented 1 year ago

yup - exact same fix too.

jeffpm commented 1 year ago

Also seeing the error from #103 when hitting the incidents API

mvilanova commented 1 year ago

We're having the same issue.

Deconstrained commented 1 year ago

Pardon the late response, folks! v5.0.2 has the changes from #103 and a generic fix (this may be more common) is underway.