Skip to content

Commit 4d98a3f

Browse files
committed
Merge pull request #28 from mattolson/0.10.3
Prepare for 0.11.0 release
2 parents 955be5b + 44aeefc commit 4d98a3f

File tree

6 files changed

+152
-125
lines changed

6 files changed

+152
-125
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
### 0.10.3
1+
### 0.11.0
22

33
* [jtallieu] Add support for Google product mappings endpoint
4+
* [mattolson] Add counts for all resources and subresources that support it
45
* [mattolson] Refactor to allow override of paths; Extract delete_all into a separate class
56
* [sebaacuna] Add support for Product count
67
* [mattolson] Allow override of auth endpoint with environment var

LICENSE renamed to LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) BigCommerce, 2013.
1+
Copyright (C) BigCommerce, 2015.
22
All rights reserved.
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -17,4 +17,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1717
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1818
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1919
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20-
THE SOFTWARE.
20+
THE SOFTWARE.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include *.txt *.md
1+
include *.txt *.md *.rst
22
exclude scripts/*

README.md

Lines changed: 0 additions & 101 deletions
This file was deleted.

README.rst

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
Bigcommerce API Python Client
2+
==================================
3+
4+
|Build Status| |Package Version| |Downloads|
5+
6+
Wrapper over the ``requests`` library for communicating with the Bigcommerce v2 API.
7+
8+
Install with ``pip install bigcommerce`` or ``easy_install bigcommerce``. Tested with
9+
python 2.7 and 3.4, and only requires ``requests`` and ``streql``.
10+
11+
Usage
12+
-----
13+
14+
Connecting
15+
~~~~~~~~~~
16+
17+
.. code:: python
18+
19+
import bigcommerce
20+
21+
# Public apps (OAuth)
22+
# Access_token is optional, if you don't have one you can use oauth_fetch_token (see below)
23+
api = bigcommerce.api.BigcommerceApi(client_id='', store_hash='', access_token='')
24+
25+
# Private apps (Basic Auth)
26+
api = bigcommerce.api.BigcommerceApi(host='store.mybigcommerce.com', basic_auth=('username', 'api token'))
27+
28+
``BigcommerceApi`` also provides two helper methods for connection with OAuth2:
29+
30+
- ``api.oauth_fetch_token(client_secret, code, context, scope, redirect_uri)``
31+
-- fetches and returns an access token for your application. As a
32+
side effect, configures ``api`` to be ready for use.
33+
34+
- ``BigcommerceApi.oauth_verify_payload(signed_payload, client_secret)``
35+
-- Returns user data from a signed payload.
36+
37+
Accessing and objects
38+
~~~~~~~~~~~~~~~~~~~~~
39+
40+
The ``api`` object provides access to each API resource, each of which
41+
provides CRUD operations, depending on capabilities of the resource:
42+
43+
.. code:: python
44+
45+
api.Products.all() # GET /products
46+
api.Products.get(1) # GET /products/1
47+
api.Products.create(name='', type='', ...) # POST /products
48+
api.Products.get(1).update(price='199.90') # PUT /products/1
49+
api.Products.delete_all() # DELETE /products
50+
api.Products.get(1).delete() # DELETE /products/1
51+
api.Products.count() # GET /products/count
52+
53+
The client provides full access to subresources, both as independent
54+
resources:
55+
56+
::
57+
58+
api.ProductOptions.get(1) # GET /products/1/options
59+
api.ProductOptions.get(1, 2) # GET /products/1/options/2
60+
61+
And as helper methods on the parent resoource:
62+
63+
::
64+
65+
api.Products.get(1).options() # GET /products/1/options
66+
api.Products.get(1).options(1) # GET /products/1/options/1
67+
68+
These subresources implement CRUD methods in exactly the same way as
69+
regular resources:
70+
71+
::
72+
73+
api.Products.get(1).options(1).delete()
74+
75+
Filters
76+
~~~~~~~
77+
78+
Filters can be applied to ``all`` methods as keyword arguments:
79+
80+
.. code:: python
81+
82+
customer = api.Customers.all(first_name='John', last_name='Smith')[0]
83+
orders = api.Orders.all(customer_id=customer.id)
84+
85+
Error handling
86+
~~~~~~~~~~~~~~
87+
88+
Minimal validation of data is performed by the client, instead deferring
89+
this to the server. A ``HttpException`` will be raised for any unusual
90+
status code:
91+
92+
- 3xx status code: ``RedirectionException``
93+
- 4xx status code: ``ClientRequestException``
94+
- 5xx status code: ``ServerException``
95+
96+
The low level API
97+
~~~~~~~~~~~~~~~~~
98+
99+
The high level API provided by ``bigcommerce.api.BigcommerceApi`` is a
100+
wrapper around a lower level api in ``bigcommerce.connection``. This can
101+
be accessed through ``api.connection``, and provides helper methods for
102+
get/post/put/delete operations.
103+
104+
Further documentation
105+
---------------------
106+
107+
Full documentation of the API is available on the Bigcommerce
108+
`Developer Portal <http://developer.bigcommerce.com>`__
109+
110+
To do
111+
-----
112+
113+
- Automatic enumeration of multiple page responses
114+
115+
.. |Build Status| image:: https://travis-ci.org/bigcommerce/bigcommerce-api-python.png?branch=master
116+
:target: https://travis-ci.org/bigcommerce/bigcommerce-api-python
117+
.. |Package Version| image:: https://pypip.in/v/bigcommerce/badge.png
118+
:target: https://pypi.python.org/pypi/bigcommerce
119+
.. |Downloads| image:: https://pypip.in/d/bigcommerce/badge.png
120+
:target: https://pypi.python.org/pypi/bigcommerce

setup.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,34 @@ def read(fname):
66
return open(os.path.join(os.path.dirname(__file__), fname)).read()
77

88
setup(
9-
name = "bigcommerce",
10-
version = "0.10.2",
9+
name = 'bigcommerce',
10+
version = '0.11.0',
1111

12-
packages=find_packages(),
13-
package_data = {'' : ['LICENSE', 'README.md']},
14-
install_requires = ['requests>=2.1.0',
15-
'streql>=3.0.2'],
16-
author = "Bigcommerce Engineering",
17-
author_email = "[email protected]",
18-
description = "Connect Python applications with the Bigcommerce API",
19-
license = "MIT",
20-
keywords = "bigcommerce api client",
21-
url = "https://github.com/bigcommerce/bigcommerce-api-python",
12+
packages = find_packages(),
13+
install_requires = ['requests>=2.1.0', 'streql>=3.0.2'],
2214

23-
long_description=read('README.md'),
24-
classifiers=[
25-
"Development Status :: 3 - Alpha",
26-
"Topic :: Software Development :: Libraries :: Python Modules",
27-
"Topic :: Office/Business",
28-
"License :: OSI Approved :: MIT License",
29-
"Programming Language :: Python",
30-
"Programming Language :: Python :: 3"
15+
url = 'https://github.com/bigcommerce/bigcommerce-api-python',
16+
download_url = 'https://github.com/bigcommerce/bigcommerce-api-python/releases',
17+
18+
author = 'Bigcommerce Engineering',
19+
author_email = '[email protected]',
20+
21+
description = 'Connect Python applications with the Bigcommerce API',
22+
long_description = read('README.rst'),
23+
license = 'MIT',
24+
25+
keywords = ['bigcommerce', 'api', 'v2', 'client'],
26+
classifiers = [
27+
'Development Status :: 4 - Beta',
28+
'Topic :: Software Development :: Libraries :: Python Modules',
29+
'Topic :: Office/Business',
30+
'Topic :: Internet :: WWW/HTTP',
31+
'Intended Audience :: Developers',
32+
'License :: OSI Approved :: MIT License',
33+
'Programming Language :: Python',
34+
'Programming Language :: Python :: 2',
35+
'Programming Language :: Python :: 3',
36+
'Programming Language :: Python :: 2.7',
37+
'Programming Language :: Python :: 3.4'
3138
],
3239
)

0 commit comments

Comments
 (0)