An interface to the Ecwid shopping platform API
Project description
pyecwid
Python wrapper for Ecwid REST API
Requirements
Installation
$ python -m pip install pyecwid
Implemented Features - Product CRUD
-
Product
- product(id) - get product details
- product_add(product) - add product (dict)
- product_delete(id) - remove product
- product_update(id, {values}) - update product with values (dict)
- product_variations(product_id) - get all variations/combinations for a product
- product_varation_update(product_id, variation_id, {values}) - update one item varation with values (dict)
-
Products
- products() - return all products
- products_by_keyword('keyword') - search products for keyword
- products_by_params({params}) - pass dict of paramaters to products API
-
Product types (classes)
- product_classes() - return all configured product types in the store
Initialisation
from pyecwid import EcwidAPI
ecwid = EcwidAPI(api_token,store_id)
EcwidAPI Aarguments
Argument | Required | Description | Default Value |
---|---|---|---|
api_token | Yes | The secret_ or public_ token for your store. | |
store_id | Yes | The ID of your store. | |
skip_test | No | True/False. Skips test call to API during initiaization (used in tests) | False |
base_url | No | Replace the hard coded URL Note: format includes {0} for store_id |
'https://app.ecwid.com/api/v3/{0}/' |
Sample: Search products for items matching keyword 'sunglasses'
from pprint import pprint
from pyecwid import EcwidAPI
ecwid = EcwidAPI('public_ASDF','1234567')
items = ecwid.products_by_keyword('sunglasses')
pprint(items)
Sample: Return all products and create a list of items with 'USB' in the name.
from pyecwid import EcwidAPI
API_TOKEN = 'secret_ASDF'
API_STORE = '1234567'
ecwid = EcwidAPI(API_TOKEN,API_STORE)
items = ecwid.products()
usb_list = list(filter(lambda items: 'USB' in items.get('name'), items))
pprint(usb_list)
Sample: Provide a paramater dict as search terms
from pyecwid import EcwidAPI
API_TOKEN = 'secret_ASDF'
API_STORE = '1234567'
ecwid = EcwidAPI(API_TOKEN,API_STORE)
params = { 'createdFrom': '2016-04-25', 'createdTo': '2020-12-25' }
items = ecwid.products_by_params(params)
pprint(items)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyecwid-0.0.4b0.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for pyecwid-0.0.4b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24fc63e9a5764e5e81c4b356cdc17af33d20de7772d403320be4b4b0831e8b44 |
|
MD5 | 94e5bf487726e85bc4bd7a87e6e602cd |
|
BLAKE2b-256 | 5a41d67c7fc94d0a228c66df6a6ba4aad24a04cdba815e8af842aaf12173586b |