PagerDuty / pdpyras

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

ValueError: unsupported format character 'B' (0x42) at index 63 #104

Closed Synamedia-lmerida closed 1 year ago

Synamedia-lmerida commented 1 year ago

I am attempting to use service id as parameter to obtain only incidents liked to a particular service. When using params={'service_ids[]':service_id,'since': since, 'until': until}) python returns ValueError, not sure what the problem is. Any ideas or assistance would be welcome, not sure if this is a code bug or if I am not using the parameters correctly.

Here the code snippet

from pdpyras import APISession
api_token = '###API TOKEN###'
session = APISession(api_token)
since = "2023-05-01"
until = "2023-05-03"

params = {'since': since,'until': until}

services = session.list_all('services', params={
    'query': 'X1'
    })

for service in services:
    #print('Service Name:',service['name'], 'Service ID:',service['incidents'])
    if service['status']=='active':
        #print('SERVICE INFO:',service)
        service_id = ['']

        print('service_id', service['id'])
        if service['id'] == "PYIV5OL":
            incidents = session.list_all('incidents', params={'service_ids[]':service_id,'since': since, 'until': until})
            print('INCIDENTS INFO:', incidents)
Synamedia-lmerida commented 1 year ago

NVM I see pull requests as per this

Synamedia-lmerida commented 1 year ago

Pull request that addresses this issue found