forked from bigcommerce/bigcommerce-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.py
More file actions
34 lines (25 loc) · 1.03 KB
/
Copy pathbasic.py
File metadata and controls
34 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
STORE_HOST = "www.YOURHOST.com"
STORE_TOKEN = "YOUR_TOKEN"
STORE_USERID = "userid"
from settings import *
import sys
import logging
from pprint import pprint
from Bigcommerce.api import ApiClient
logging.basicConfig(level=logging.DEBUG,
stream=sys.stdout,
format='%(asctime)s %(levelname)-8s[%(name)s] %(message)s',
datefmt='%m/%d %H:%M:%S')
log = logging.getLogger("main")
if __name__ == "__main__":
log.debug("HOST %s, USER: %s" % (STORE_HOST, STORE_USERID))
api = ApiClient(STORE_HOST, STORE_TOKEN, STORE_USERID)
filters = api.Products.filters()
# List 10 products starting at offset 10
for product in api.Products.enumerate(start=10, limit=10, query=filters):
print product.id, product.sku, product.name, product.price
pass
order = api.Orders.get(101)
print "Order", order.id, order.date_created
for product in order.products:
print product.quantity, product.name