Press ESC to close

woocommerce 使用python 发布商品

代码:

#!/usr/bin/env python3
from woocommerce import API

wcapi = API(
  url="https://www.xatest.com/",
  consumer_key="xxxxxxxx",
  consumer_secret="cs_5xxx3029f1621db69404ce5702",
  timeout=50
)

product_data = {
    "name": "Simple example product",
    "type": "simple",
    "regular_price": "22.50",
    "stock_quantity": 10,
    "short_description": "just an example product",
    "description": "This is just an example product, created with the Woocommerce REST API",
    "categories": [
      {
        "id": 17
      }
    ],

    "images": [
        {
            "src": "https://xxx/images/linuxconfig_logo.png",
            "alt": "example-image"
        }
    ]
}
response = wcapi.post('products', product_data)

发表回复