Skip to content

(Some) API calling functions don't properly parse Python boolean values as parameters #508

@BryanBaird

Description

@BryanBaird

Current behavior

When calling a list() function or similar, the API often accepts a boolean parameter for filtering results. For example, the \REPORTS\ GET endpoint allows a boolean filter for archived status.

When the results are returned with the Python client, these fields are properly cast as Python boolean values. But when trying to pass in the parameter to the query, the client requires the value to be passed as a string instead.

Example

This fails:

import civis
client = civis.APIClient()
client.reports.list(limit=10, archived = False)

CivisAPIError: (400) Invalid archived status 'False'.

But this succeeds:

import civis
client = civis.APIClient()
client.reports.list(limit=10, archived = "false")

Expected behavior

Use the native data type(s) for the language, and parse those into whatever structure is needed for the url path on the API call.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions