Skip to content

Commit 312fbfa

Browse files
authored
Improve support for storing more data types in key-value stores (#68)
Improve JSON-stringification of values of non-default types when encoding a key-value store record.
1 parent 1026331 commit 312fbfa

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
[0.4.0](../../releases/tag/v0.4.0) - 2021-09-07
5+
-----------------------------------------------
6+
7+
### Changed
8+
9+
- improved support for storing more data types in key-value stores
10+
411
[0.3.0](../../releases/tag/v0.3.0) - 2021-08-26
512
-----------------------------------------------
613

src/apify_client/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def _encode_key_value_store_record_value(value: Any, content_type: Optional[str]
198198
content_type = 'application/json; charset=utf-8'
199199

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

203203
return (value, content_type)
204204

src/apify_client/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.3.0'
1+
__version__ = '0.4.0'

0 commit comments

Comments
 (0)