Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 9caf232

Browse files
committed
Set repsonse encoding to UTF-8 to avoid chardet
The performance of the default chardet used by requests can be very poor and since the JSON is UTF-8 we can avoid going throught that detection.
1 parent c296a5a commit 9caf232

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
3+
- [FIXED] A performance regression deserializing JSON in version 2.10.1.
4+
15
# 2.10.1 (2018-11-16)
26

37
- [FIXED] Unexpected keyword argument errors when using the library with the

src/cloudant/_common_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ def response_to_json_dict(response, **kwargs):
288288
289289
:returns: dict of JSON response
290290
"""
291+
if response.encoding is None:
292+
response.encoding = 'utf-8'
291293
return json.loads(response.text, **kwargs)
292294

293295
# Classes

0 commit comments

Comments
 (0)