Skip to main content

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

  1. 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))
  1. Retrieve an order
order = api.orders.get(id)
print(vars(order))
  1. Update an order
order = api.orders.get(id)
order.internalComment = 'this is my new comment'
api.orders.update(order)
  1. Mark an order as PAID
order = api.orders.get(id)
api.orders.mark_as_paid(order)
  1. Mark an order as PACKED
order = api.orders.get(id)
api.orders.mark_as_packed(order)
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-brickscout-api-1.1.2.tar.gz (22.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page