10000 Force utf-8 encoding in API.__request() · torrelasley/wc-api-python@6458326 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6458326

Browse files
committed
Force utf-8 encoding in API.__request()
Just before sending data , encode it (if it's not None) in utf-8 to avoid UnicodeDecodeError with requests.
1 parent 198f219 commit 6458326

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

woocommerce/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __request(self, method, endpoint, data):
6666
url = self.__get_oauth_url(url, method)
6767

6868
if data is not None:
69-
data = jsonencode(data, ensure_ascii=False)
69+
data = jsonencode(data, ensure_ascii=False).encode('utf-8')
7070

7171
return request(
7272
method=method,

0 commit comments

Comments
 (0)
0