Python Forum
response 404 or 500 when trying to get products/sales from woocommerce using python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
response 404 or 500 when trying to get products/sales from woocommerce using python
#1
Hi
I'm trying to get product and sales data from woocommerce using python

here is my code

import json
from woocommerce import API

wcapi = API(
url="https://abc",
consumer_key="ck_abc",
consumer_secret="cs_abc",
version="wc/v3",
timeout=50
)

response = wcapi.get('products', params={'per_page': 20})
print(response)
and I got this error

Error:
Exception has occurred: JSONDecodeError Expecting value: line 1 column 1 (char 0) StopIteration: 0 During handling of the above exception, another exception occurred: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: File "X:\test.py", line 16, in <module> print(wcapi.get("products", params={"per_page": 20}).json()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
May I know what have i done wrong?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  All product links to products on a website MarionStorm 0 1,095 Jun-02-2022, 11:17 PM
Last Post: MarionStorm
  Return Frame as well as JSON response using same API in Flask Python Ask jenkins43 0 1,878 May-11-2020, 04:58 PM
Last Post: jenkins43
  Flask-Sqlalchemy count products in specific category imawesome 2 30,364 Mar-12-2020, 08:14 PM
Last Post: imawesome

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020