response.status_code on insert a product
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
Research direction
Start by reproducing the wcapi.post("products", data) call from the issue and inspect the returned status and body, then compare it with the subsequent wcapi.delete("products/108", params={"force": True}) call. Done means identifying why the insert reports 200 without creating the product and documenting or correcting the relevant behavior.
Written by the indexing model from the issue text.
Description
I have been trying to use a simple code to post a product on WooCommerce from Python.
Im trying this code:
import sys
import googlemaps
from woocommerce import API
import base64
wcapi = API(
url="https://mysite.com",
consumer_key="ck_e6*********************************b9c5", # Your consumer key
consumer_secret="cs_3e*********************************e7de19", # Your consumer secret
wp_api=True, # Enable the WP REST API integration
version="wc/v3", # WooCommerce WP REST API version
query_string_auth=True,
timeout=10
)
data = {
"name": "Premium Quality",
"type": "simple",
"description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",
"short_description": "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.",
}
response = wcapi.post("products", data)
print("Status: ", response.status_code)
if response.status_code == 201:
print("Success")
else:
print("Error")
# print(response.text)
sys.exit()
I have gotten the "200" status.
Notthing was post on woocommerce.
After i tryed delete with the code:
print(wcapi.delete("products/108", params={"force": True}).json())
And deleted success.
Where am I going wrong?
Tks
- Dominant language
- Python
- Stars
- 216
- Forks
- 108
- Avg merge
- 6h 34m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from woocommerce/wc-api-python
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
woocommerce/wc-api-python#108 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
woocommerce/wc-api-python#106 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
woocommerce/wc-api-python#105 ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
woocommerce/wc-api-python#104 ·
-
Json Formatting Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
woocommerce/wc-api-python#103 ·
All issues in woocommerce/wc-api-python
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100