Skip to content

Commit f5e3bc9

Browse files
authored
Update api.py
1 parent 933a0fa commit f5e3bc9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

woocommerce/api.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,9 @@ def __request(self, method, endpoint, data, params=None, **kwargs):
7070
params = {}
7171
url = self.__get_url(endpoint)
7272
auth = None
73-
headers = {
74-
"user-agent": "WooCommerce API Client-Python/%s" % __version__,
75-
"accept": "application/json"
76-
}
73+
headers = kwargs.get('headers', {})
74+
headers['user-agent'] = "WooCommerce API Client-Python/%s" % __version__
75+
headers['accept'] = "application/json"
7776

7877
if self.is_ssl is True and self.query_string_auth is False:
7978
auth = (self.consumer_key, self.consumer_secret)
@@ -87,7 +86,7 @@ def __request(self, method, endpoint, data, params=None, **kwargs):
8786
url = "%s?%s" % (url, encoded_params)
8887
url = self.__get_oauth_url(url, method, **kwargs)
8988

90-
if data is not None:
89+
if data is not None and not headers.get('content-type'):
9190
data = jsonencode(data, ensure_ascii=False).encode('utf-8')
9291
headers["content-type"] = "application/json;charset=utf-8"
9392

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy