Skip to main content

BlackCurve Python API Library

BlackCurve

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 blackcurve

Basic Usage

Initiate a Connection

You just need your subdomain and a access token to get started

   from blackcurve.api import BlackCurveAPI	
   bc = BlackCurveAPI({{ subdomain }}, {{ access_token }})	

Reload a Access Token

Need a new access token, or just misplaced the old one?

   bc = BlackCurveAPI({{ 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 Product ID
   bc.prices().find('UK42')

   # 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
   data_sources = bc.data_sources_info().all()
   print(data_sources)

   # get a single data source
   sales_history = bc.data_sources_info().find('Sales History')
   print(sales_history)

   # create a new column 
   sales_history['New Order Column'] = 'Integer'
   sales_history.save()

   # delete a column
   del sales_history['New Order Column']
   sales_history.save()

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('Sales History').all()

   # get just the volume and product id columns in sales history
   bc.data_sources('Sales History', columns=['Volume', 'Product ID']).all()

   # filter by column value -- price >= 5
   bc.data_sources('Sales History', price_gte=5).all()

   # get a generator for all the pages returned in sales history (lazy requests)
   sales_history = bc.data_sources('Sales History').all()
   page = 1
   for x in sales_history:
   	print('Page %s of Sales History: %s' % (page, x))
   	page += 1

   # get a Transactions system id
   sales_history = bc.data_sources('Sales History').all()
   first_sale = sales_history[0]
   first_sale_id = first_sale.id

   # find a transaction by a system id
   first_sale = bc.data_sources('Sales History').find(first_sale_id)

   # edit a column on a transaction
   first_sale['Price'] = 42.00
   first_sale.save()

   # create a new transaction
   sales_history = bc.data_sources('Sales History')
   sales_history.create({
       'Product ID': 'UK54321',
       'Profit': 7.77,
       'Revenue': 6.66,
       'Volume': 1,
       'Price': 3.33,
       'Transaction Date': datetime.date.today()
   })

   # get all transactions for a given product id
   transactions = bc.data_sources('Sales History', product_id='UK54321').all()
   print('There are {} transactions for product - UK54321'.format(len(transactions)))

   # change the price of a product [must use the kwarg product_id as .find() is only for system id] 
   product = bc.data_sources('Product Inventory', product_id='UK54321').all()[0]
   product['Price'] = 55.99
   product.save()

Geographies & Currencies

Get a list of associated data for Geographies and Currencies

    # get a list of all of the geography data
    all_geographies = bc.geographies().all()

    # get a specific geography
    website_uk = bc.geographies('Website UK').all()

    # get a list of all currencies
    all_currencies = bc.currencies().all()

Metadata

Release files for blackcurve 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blackcurve 0.3.1
File Size Uploaded Provenance Actions
blackcurve-0.3.1.tar.gz 8.6 kB Without provenance Details for blackcurve-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blackcurve 0.3.1
File Interpreter ABI Platform Actions
blackcurve-0.3.1-py3-none-any.whl Python 3 none any Details for blackcurve-0.3.1-py3-none-any.whl

Total release size: 18.2 kB

Release files / blackcurve-0.3.1.tar.gz

Download URL blackcurve-0.3.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
473c6162b6125b7c0c907e57e6c0c9775ef5c26475a08eb7734f092141dbd94c
BLAKE2b-256 checksum
How to use checksums
c51214c35ad1ac5b0cfe551f3b66abe39cfbbaf621b0fd8ae2bcf994198c5996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Release files / blackcurve-0.3.1-py3-none-any.whl

Download URL blackcurve-0.3.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b65dd912cf7f16136abfbd3e211dc9081fff05d3b89c56cdda7c3d9546c4866
BLAKE2b-256 checksum
How to use checksums
8314a9a30426d76de76547b80514b711c8e553c4d50eb333a5e0b934beccb136
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

Security for blackcurve 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page