- Notifications
You must be signed in to change notification settings - Fork110
Open
Description
I have been trying to use a simple code to post a product on WooCommerce from Python.
Im trying this code:
import sysimport googlemapsfrom woocommerce import APIimport base64wcapi = 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
Metadata
Metadata
Assignees
Labels
No labels