Skip to content

Commit

Permalink
Fix base HTTP client parse_params method (#172)
Browse files Browse the repository at this point in the history
Closes #171
  • Loading branch information
vdusek authored Dec 11, 2023
1 parent a8e54f5 commit eb9492e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## [1.6.1](../../releases/tag/v1.6.1) - Unreleased

...
### Fixed

- Fixed `_BaseHTTPClient._parse_params()` method to ensure correct conversion of API list parameters

## [1.6.0](../../releases/tag/v1.6.0) - 2023-11-16

Expand Down
7 changes: 5 additions & 2 deletions src/apify_client/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ def _parse_params(params: dict | None) -> dict | None:
if params is None:
return None

parsed_params = {}
parsed_params: dict = {}
for key, value in params.items():
# Our API needs to have boolean parameters passed as 0 or 1, therefore we have to replace them
# Our API needs boolean parameters passed as 0 or 1
if isinstance(value, bool):
parsed_params[key] = int(value)
# Our API needs lists passed as comma-separated strings
elif isinstance(value, list):
parsed_params[key] = ','.join(value)
elif value is not None:
parsed_params[key] = value

Expand Down

0 comments on commit eb9492e

Please sign in to comment.