I am trying to get the json data of my woocommerce product list with python but I keep getting errors despite supplying the necessary details. If I try to get the text format, it returns the html correctly.
from woocommerce import API
wcapi = API(url='http://localhost/mysite/index.php/product/pizza/',
consumer_key="ck_xxxxxxxxxxx",
consumer_secret="cs_xxxxxxxxx",
version="wc/v3")
get_product=wcapi.get("products").json()
print(get_product)
The Error:
JSONDecodeError Traceback (most recent call last)
<ipython-input-27-d30acb9b03bb> in <module>
4 consumer_secret="cs_ee6fbd92294f88051d8e1a5a2c0201ab1a0f6aff",
5 version="wc/v3")
----> 6 get_product=wcapi.get("products").json()
7 print(get_product)
~\anaconda3\lib\site-packages\requests\models.py in json(self, **kwargs)
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
976
977 @property
JSONDecodeError: Expecting value: line 1 column 1 (char 0)