PagerDuty / pdpyras

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

Didn't find a way to `pass statuses[] more than once` #98

Closed thanch2n closed 1 year ago

thanch2n commented 1 year ago

Looks we can't use same key with different values in dict and pass to params. But on server side it supports To query multiple statuses, pass statuses[] more than once, https://developer.pagerduty.com/api-reference/9d0b4b12e36f9-list-incidents.

        params = {
            'statuses[]': 'acknowledged',
            'statuses[]': 'triggered',
            'statuses[]': 'resolved',
        }
        for incident in session.iter_all('incidents', params):
            yield incident
Deconstrained commented 1 year ago

Note, pdpyras.APISession is a wrapper of requests.Session.

Per Passing parameters in URLs, The way to pass multi-valued parameters when using a dictionary is to have one key pointing to a list i.e. 'statuses[]': ['acknowledged', 'triggered', 'resolved']

Deconstrained commented 1 year ago

Added to list of things to document with the release of v5.0

Deconstrained commented 1 year ago

97 will take care of this