woocommerce / woocommerce/wc-api-python

Fetching 'products' fails with a 403 error despite other successful API calls

Open
#80 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
216
Forks
108
Avg merge
6h 34m
Merged PRs (30d)
1

Description

Hello! Thanks for this library, though I'm having a little trouble retrieving products specifically. I have no trouble retrieving e.g. orders and customers.

This works:

import os
from woocommerce import API

WOOCOMMERCE_API_CONSUMER_KEY = os.environ.get('WOOCOMMERCE_API_CONSUMER_KEY')
WOOCOMMERCE_API_CONSUMER_SECRET = os.environ.get('WOOCOMMERCE_API_CONSUMER_SECRET')  # noqa

wcapi = API(
    url='https://xxxxxxxx.org',
    consumer_key=WOOCOMMERCE_API_CONSUMER_KEY,
    consumer_secret=WOOCOMMERCE_API_CONSUMER_SECRET,
    version='wc/v3',
    user_agent='PostmanRuntime/7.26.5'
)

data = wcapi.get('orders')
# data = wcapi.get('customers')

print(data.status_code)

Trying wcapi.get('products'), however, throws a 403 status code:

import os
from woocommerce import API

WOOCOMMERCE_API_CONSUMER_KEY = os.environ.get('WOOCOMMERCE_API_CONSUMER_KEY')
WOOCOMMERCE_API_CONSUMER_SECRET = os.environ.get('WOOCOMMERCE_API_CONSUMER_SECRET')  # noqa

wcapi = API(
    url='https://xxxxxxxx.org',
    consumer_key=WOOCOMMERCE_API_CONSUMER_KEY,
    consumer_secret=WOOCOMMERCE_API_CONSUMER_SECRET,
    version='wc/v3',
    user_agent='PostmanRuntime/7.26.5'
)

data = wcapi.get('products')

print(data.status_code)

Any help is much appreciated, thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by running the provided Python examples and comparing the requests and 403 response for products with the successful orders and customers calls; done means establishing whether the wrapper or the WooCommerce endpoint causes the failure and documenting a reproducible next step.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.