Пытаюсь создать товар по документации:
from woocommerce import API
wcapi = API(
url="http://...",
consumer_key="ck_...",
consumer_secret="cs_...",
version="wc/v3"
)
data = {
"name": "Товар 1",
"type": "simple",
"regular_price": "777",
"description": "Мое описание",
"short_description": "Короткое описание",
"images": [
{
"src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg"
}
]
}
print(wcapi.post("products", data).json())
Ответ:
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/API/test.py", line 34, in <module>
print(wcapi.post("products", data).json())
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)