Wrapper for the BrickScout API
Project description
python-brickscout-api
Wrapper for the BrickScout API
Install
This package is published on PyPi: https://pypi.org/project/python-brickscout-api/
Install with pip
pip install python-brickscout-api
Usage
Usage at this point is minimal. I will extend this package as I go and as I need.
Create connection
You will need your username and password.
Create a new API connection
from brickscout.api import BrickScoutAPI
api = BrickScoutAPI(username='xxx', password='xxx')
Orders
- Get all open orders
Orders are considered open if they have not been marked as deleted or shipped.
orders = api.orders.get_open_orders()
for order in orders.iterator():
print(vars(order))
- Retrieve an order
order = api.orders.get(id)
print(vars(order))
- Update an order
order = api.orders.get(id)
order.internalComment = 'this is my new comment'
api.orders.update(order)
- Mark an order as PAID
order = api.orders.get(id)
api.orders.mark_as_paid(order)
- Mark an order as PACKED
order = api.orders.get(id)
api.orders.mark_as_packed(order)
- Mark an order as SHIPPED
order = api.orders.get(id)
api.orders.mark_as_shipped(order)
Error handling
Basic error handling has been added. You can check if an error has occured during a call by checking the has_error
attribute on an object. If the has_error
has been set to True
, an Error
object will be attached to the error
attribute of the same object. The Error
object contains following attributes: type
, exception_code
, developer_message
, more_info_url
and timestamp
.
order = api.orders.get(id)
if order.has_error:
print(order.error.exception_code)
print(order.error.developer_message)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for python-brickscout-api-1.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ac478c863411a29a03bd4c469ebf97eec5a6340fa879511cbc9a1e86a0bfda |
|
MD5 | 2fe43e596f4c5666382b55c2cc0c6595 |
|
BLAKE2b-256 | 25199d7728d0f2c92adc350dd452a67a8898e90e7bf4b34a5c3362af6e326271 |