wc-api-python: wcapi.get('orders') returns 403
I connect to my WooCommerce webshop through the WooCommerce REST API Python wrapper,
I.e,
from woocommerce import API
wcapi = API(
url="https://mywebshop.whatever",
consumer_key="ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
consumer_secret="cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
wp_api=True,
version="wc/v1"
)
API has read/write access.
All worked fine for months up to yesterday.
Problem
Since yesterday latest_order = wcapi.get('orders').json()
returns a JSONDecodeError: Expecting value
. Also, wcapi.get('orders')
returns a <Response [403]>
.
I don’t know what’s causing this all of a sudden and I’m not sure how to solve it either.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 20 (9 by maintainers)
When specifying the
user_agent
, the request goes through:This got fixed by https://github.com/woocommerce/wc-api-python/pull/57, thanks @Evert-Arends for your help. Note that I’ll release 3.0 soon, we’ll drop support to unsupported Python releases. The older releases of this lib seems to be still working with Python 2.7 in my tests.
@imansdn the message it’s clear, your user don’t have permission to access.
Doesn’t sound like a problem in this library, since is just the response for your website, need to check your site.