How to use the bigcommerce.api function in bigcommerce

To help you get started, we’ve selected a few bigcommerce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigcommerce / bigcommerce-api-python / tests / test_api.py View on Github external
def test_create_basic(self):
        api = bigcommerce.api.BigcommerceApi(host='store.mybigcommerce.com', basic_auth=('admin', 'abcdef'))
        self.assertIsInstance(api.connection, Connection)
        self.assertNotIsInstance(api.connection, OAuthConnection)
github bigcommerce / bigcommerce-api-python / tests / test_api.py View on Github external
def test_create_oauth(self):
        api = bigcommerce.api.BigcommerceApi(client_id='123456', store_hash='abcdef', access_token='123abc')
        self.assertIsInstance(api.connection, OAuthConnection)
github bigcommerce / bigcommerce-api-python / tests / test_api.py View on Github external
        self.assertRaises(AttributeError, lambda: bigcommerce.api.ApiResourceWrapper.str_to_class('ApiResourceWhichDoesNotExist'))
github bigcommerce / bigcommerce-api-python / examples / ex_basic.py View on Github external
from __future__ import print_function
import bigcommerce.api

api = bigcommerce.api.BigcommerceApi(client_id='id', store_hash='hash', access_token='token')

products = api.Products.all(is_visible=True)

custom = api.ProductCustomFields.create(products[0].id, name="Manufactured in", text="Australia")

custom.update(text="USA", name="Manufactured in")

print(api.ProductCustomFields.get(products[0].id, custom.id))

print(products[0].custom_fields(custom.id).delete())

print(api.Countries.all(country="Australia")[0].states()[0].parent_id())
github bigcommerce / bigcommerce-api-python / examples / ex_time.py View on Github external
from __future__ import print_function
import bigcommerce.api

api = bigcommerce.api.BigcommerceApi(client_id='id', store_hash='hash', access_token='token')

print(repr(api.Time.all()))
github bigcommerce / bigcommerce-api-python / examples / ex_login_token.py View on Github external
from __future__ import print_function
import bigcommerce.api
import bigcommerce.customer_login_token
import os

# Customer login tokens must be signed with an app secret loaded in the environment
os.environ['APP_CLIENT_SECRET'] = 'client secret'

# Create API object using OAuth credentials
api = bigcommerce.api.BigcommerceApi(client_id='id', store_hash='hash', access_token='token')

# Create a new customer
api.Customers.create(first_name='Bob', last_name='Johnson', email='bob.johnson@example.com')

# Or get the customer if they already exist
customer = api.Customers.all(email='bob.johnson@example.com')[0]

# Create the JWT login token
login_token = bigcommerce.customer_login_token.create(api, customer.id)

print('Token: %s' % login_token)

# You can build the URL yourself
print('%s/login/token/%s' % ('https://domain.com', login_token))

# Or use the helper method to build the URL. This uses 1 API request to get the secure domain for the store,