Skip to main content

A Python wrapper for the WooCommerce REST API

Project description

A Python wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library.

https://secure.travis-ci.org/woothemes/wc-api-python.svg

Installation

pip install woocommerce

Getting started

Generate API credentials (Consumer Key & Consumer Secret) following this instructions http://docs.woothemes.com/document/woocommerce-rest-api/.

Check out the WooCommerce API endpoints and data that can be manipulated in http://woothemes.github.io/woocommerce-rest-api-docs/.

Setup

from woocommerce import API

wcapi = API(
    url="http://example.com",
    consumer_key="ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    consumer_secret="cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
)

Options

Option

Type

Required

Description

url

string

yes

Your Store URL, example: http://woo.dev/

consumerKey

string

yes

Your API consumer key

consumerSecret

string

yes

Your API consumer secret

version

string

no

API version, default is v3

verify_ssl

bool

no

Verify SSL when connect, use this option as false when need to test with self-signed certificates

Methods

Params

Type

Description

endpoint

string

WooCommerce API endpoint, example: customers or order/12

data

dictionary

Data that will be converted to JSON

GET

  • .get(endpoint)

POST

  • .post(endpoint, data)

PUT

  • .put(endpoint, data)

DELETE

  • .delete(endpoint)

Response

All methods will return Requests object.

Example of returned data:

>>> wcapi.get("products")
>>> wcapi.status_code
200
>>> wcapi.headers['content-type']
'application/json; charset=UTF-8'
>>> wcapi.encoding
'UTF-8'
>>> wcapi.text
u'{"products":[{"title":"Flying Ninja","id":70,...' // Json text
>>> wcapi.json()
{u'products': [{u'sold_individually': False,... // Dictionary data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WooCommerce-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file WooCommerce-1.0.0.tar.gz.

File metadata

  • Download URL: WooCommerce-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for WooCommerce-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8bdd6261208efcae1a627718edf62e92c49b31c4ecbf5ed7450ff74996a997bb
MD5 99725ae25fe8ff7d3a701ba81b71d817
BLAKE2b-256 473054fcc2a9caf42cf2f057aef2431486fdec96e2b469e170641f3d2a1ce8af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page