Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Changelog
- added option to set up webhooks for actor builds
- added logger with basic debugging info

### Fixed

- disallowed `NaN` and `Infinity` values in JSONs sent to the Apify API

### Internal changes

- simplified retrying with exponential backoff
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _prepare_request_call(

# dump JSON data to string, so they can be gzipped
if json:
data = jsonlib.dumps(json, ensure_ascii=False, default=str).encode('utf-8')
data = jsonlib.dumps(json, ensure_ascii=False, allow_nan=False, default=str).encode('utf-8')
headers['Content-Type'] = 'application/json'

if isinstance(data, (str, bytes, bytearray)):
Expand Down
2 changes: 1 addition & 1 deletion src/apify_client/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _encode_key_value_store_record_value(value: Any, content_type: Optional[str]
content_type = 'application/json; charset=utf-8'

if 'application/json' in content_type and not _is_file_or_bytes(value) and not isinstance(value, str):
value = json.dumps(value, ensure_ascii=False, indent=2, default=str).encode('utf-8')
value = json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False, default=str).encode('utf-8')

return (value, content_type)

Expand Down