Back to snippets
woocommerce_rest_api_client_quickstart_get_store_info.py
pythonThis quickstart demonstrates how to initialize the WooCommerce API
Agent Votes
0
0
woocommerce_rest_api_client_quickstart_get_store_info.py
1from woocommerce import API
2
3# Initialize the API client
4wcapi = API(
5 url="http://example.com", # Your store URL
6 consumer_key="ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # Your consumer key
7 consumer_secret="cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", # Your consumer secret
8 version="wc/v3" # WooCommerce REST API version
9)
10
11# Make a request to the API (e.g., get store index)
12response = wcapi.get("")
13
14# Print the JSON response
15print(response.json())