An easy to use python interface for BlackCurve's API
Project description
BlackCurve Python API Library
API Documentation
Documentation for the BlackCurve endpoints can be found here.
Requirements
- Python 2.7+
- Requests HTTP library for python v2.0 or above.
Installation
$ pip install requests
$ pip install blackcurve_api
Basic Usage
Initiate a Connection
You just need your subdomain and a access token to get started
from blackcurve_api import BlackCurveAPI
bc = BlackCurveAPI({{ your_subdomain }}, {{ access_token }})
Reload a Access Token
Need a new access token, or just misplaced the old one?
bc = BlackCurveAPI({{ your_subdomain }})
token = bc.get_access_token({{ client_key }}, {{ client_secret }})
print(token)
This will also update your BlackCurveAPI instance with the new token so you can immediately carry on with requests.
Get Prices
Get a list of current Prices
# get all the prices
bc.prices().all()
# get all prices
prices = bc.prices().all()
print('You have {} prices'.format(len(prices)))
# get a price for a single product by id
bc.prices().find('42')
# filter specific product columns
bc.prices(columns=['Price', 'Product ID']).all()
# filter geography
bc.prices(geography='UK').all()
# filter by column value -- price >= 5
bc.prices(price_gte=5).all()
Data Sources Info
Get column and data type information about your data sources
# get all the data sources
bc.data_sources_info().all()
# get a single data source
bc.data_sources_info().find('Sales History').all()
Data Sources
Get a list of all of the data in a given source
# get all of the data from sales history
bc.data_sources().find('Sales History').all()
# get just the volume and product id columns in sales history
bc.data_sources(columns=['Volume', 'Product ID']).find('Sales History').all()
# filter by column value -- price >= 5
bc.data_sources(price_gte=5).find('Sales History').all()
# get a generator for all the pages returned in sales history
sales_history = bc.data_sources().find('Sales History').all()
page = 1
for x in sales_history:
print('Page %s of Sales History: %s' % (page, x))
page += 1
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
blackcurve-0.1.5.tar.gz
(7.2 kB
view hashes)
Built Distribution
blackcurve-0.1.5-py3-none-any.whl
(13.5 kB
view hashes)
Close
Hashes for blackcurve-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12de5443b63c8105845fb917497bfde0271152fec6a5e6323df9ec3a3cf2ba05 |
|
MD5 | 79f2762aafe1eb46267e2aa2fc552a90 |
|
BLAKE2b-256 | 049bcd2224116bb97c441ccadc0b2994506f1c4734df180a9852fcdfc7bbd2e2 |