Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.10.3
### 0.11.0

* [jtallieu] Add support for Google product mappings endpoint
* [mattolson] Add counts for all resources and subresources that support it
* [mattolson] Refactor to allow override of paths; Extract delete_all into a separate class
* [sebaacuna] Add support for Product count
* [mattolson] Allow override of auth endpoint with environment var
Expand Down
4 changes: 2 additions & 2 deletions LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) BigCommerce, 2013.
Copyright (C) BigCommerce, 2015.
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -17,4 +17,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include *.txt *.md
include *.txt *.md *.rst
exclude scripts/*
101 changes: 0 additions & 101 deletions README.md

This file was deleted.

120 changes: 120 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Bigcommerce API Python Client
==================================

|Build Status| |Package Version| |Downloads|

Wrapper over the ``requests`` library for communicating with the Bigcommerce v2 API.

Install with ``pip install bigcommerce`` or ``easy_install bigcommerce``. Tested with
python 2.7 and 3.4, and only requires ``requests`` and ``streql``.

Usage
-----

Connecting
~~~~~~~~~~

.. code:: python

import bigcommerce

# Public apps (OAuth)
# Access_token is optional, if you don't have one you can use oauth_fetch_token (see below)
api = bigcommerce.api.BigcommerceApi(client_id='', store_hash='', access_token='')

# Private apps (Basic Auth)
api = bigcommerce.api.BigcommerceApi(host='store.mybigcommerce.com', basic_auth=('username', 'api token'))

``BigcommerceApi`` also provides two helper methods for connection with OAuth2:

- ``api.oauth_fetch_token(client_secret, code, context, scope, redirect_uri)``
-- fetches and returns an access token for your application. As a
side effect, configures ``api`` to be ready for use.

- ``BigcommerceApi.oauth_verify_payload(signed_payload, client_secret)``
-- Returns user data from a signed payload.

Accessing and objects
~~~~~~~~~~~~~~~~~~~~~

The ``api`` object provides access to each API resource, each of which
provides CRUD operations, depending on capabilities of the resource:

.. code:: python

api.Products.all() # GET /products
api.Products.get(1) # GET /products/1
api.Products.create(name='', type='', ...) # POST /products
api.Products.get(1).update(price='199.90') # PUT /products/1
api.Products.delete_all() # DELETE /products
api.Products.get(1).delete() # DELETE /products/1
api.Products.count() # GET /products/count

The client provides full access to subresources, both as independent
resources:

::

api.ProductOptions.get(1) # GET /products/1/options
api.ProductOptions.get(1, 2) # GET /products/1/options/2

And as helper methods on the parent resoource:

::

api.Products.get(1).options() # GET /products/1/options
api.Products.get(1).options(1) # GET /products/1/options/1

These subresources implement CRUD methods in exactly the same way as
regular resources:

::

api.Products.get(1).options(1).delete()

Filters
~~~~~~~

Filters can be applied to ``all`` methods as keyword arguments:

.. code:: python

customer = api.Customers.all(first_name='John', last_name='Smith')[0]
orders = api.Orders.all(customer_id=customer.id)

Error handling
~~~~~~~~~~~~~~

Minimal validation of data is performed by the client, instead deferring
this to the server. A ``HttpException`` will be raised for any unusual
status code:

- 3xx status code: ``RedirectionException``
- 4xx status code: ``ClientRequestException``
- 5xx status code: ``ServerException``

The low level API
~~~~~~~~~~~~~~~~~

The high level API provided by ``bigcommerce.api.BigcommerceApi`` is a
wrapper around a lower level api in ``bigcommerce.connection``. This can
be accessed through ``api.connection``, and provides helper methods for
get/post/put/delete operations.

Further documentation
---------------------

Full documentation of the API is available on the Bigcommerce
`Developer Portal <http://developer.bigcommerce.com>`__

To do
-----

- Automatic enumeration of multiple page responses

.. |Build Status| image:: https://travis-ci.org/bigcommerce/bigcommerce-api-python.png?branch=master
:target: https://travis-ci.org/bigcommerce/bigcommerce-api-python
.. |Package Version| image:: https://pypip.in/v/bigcommerce/badge.png
:target: https://pypi.python.org/pypi/bigcommerce
.. |Downloads| image:: https://pypip.in/d/bigcommerce/badge.png
:target: https://pypi.python.org/pypi/bigcommerce
47 changes: 27 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,34 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
name = "bigcommerce",
version = "0.10.2",
name = 'bigcommerce',
version = '0.11.0',

packages=find_packages(),
package_data = {'' : ['LICENSE', 'README.md']},
install_requires = ['requests>=2.1.0',
'streql>=3.0.2'],
author = "Bigcommerce Engineering",
author_email = "vip@bigcommerce.com",
description = "Connect Python applications with the Bigcommerce API",
license = "MIT",
keywords = "bigcommerce api client",
url = "https://github.com/bigcommerce/bigcommerce-api-python",
packages = find_packages(),
install_requires = ['requests>=2.1.0', 'streql>=3.0.2'],

long_description=read('README.md'),
classifiers=[
"Development Status :: 3 - Alpha",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Office/Business",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3"
url = 'https://github.com/bigcommerce/bigcommerce-api-python',
download_url = 'https://github.com/bigcommerce/bigcommerce-api-python/releases',

author = 'Bigcommerce Engineering',
author_email = 'api@bigcommerce.com',

description = 'Connect Python applications with the Bigcommerce API',
long_description = read('README.rst'),
license = 'MIT',

keywords = ['bigcommerce', 'api', 'v2', 'client'],
classifiers = [
'Development Status :: 4 - Beta',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Office/Business',
'Topic :: Internet :: WWW/HTTP',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4'
],
)