Skip to main content

An API client for the Duro REST API

Project description

duro_rest

An API client for the Duro REST API.

Installation

Installing from PyPi

pip install duro_rest

Installing from conda-forge

TBD

Examples

The Duro client is a very minimal API client for reading data from the Duro v1 REST API. It does not define classes for each object type and instead returns plain dictionaries and lists.

Base Client

from duro_rest import Client

# Create a new client, providing your API key. By default clients will make calls to the public REST
# API, but the endpoint base can be overridden if needed
client = Client("your-api-key")

# Fetch a component by its Duro assigned id (as opposed to the CPN)
component = client.component("component-id")

# Fetch a list of all components in Duro
components = client.components()

# Fetch a list of all components in Duro filtered by status
components = client.components(status = "OBSOLETE")

BOM Client

The Duro API does not support pulling BOMs directly. The BOM Client is here to make that experience a little easier.

from duro_rest import BOMClient

# Create a new bom client for fetching full BOMs (either nested or flattened). It accepts the same
# arguments as the base client
client = Client("your-api-key")

# Get a nested BOM starting from a product
nested_product_bom = client.product_bom("product-id")

# Get a nested BOM starting from a component
nested_component_bom = client.component("component-id")

# Convert the nested BOM into flattened BOM
indented_product_bom = nested_product_bom.idented()

# Flattening will collapse rows for the same components together
flattened_product_bom = indented_product_bom.flatten()

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

duro_rest-0.0.16.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duro_rest-0.0.16-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file duro_rest-0.0.16.tar.gz.

File metadata

  • Download URL: duro_rest-0.0.16.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.4 Linux/6.2.0-37-generic

File hashes

Hashes for duro_rest-0.0.16.tar.gz
Algorithm Hash digest
SHA256 e7f8a4db8dcb6d24b8fc55d6eeed94ca0d2f13d16d776308a097d3f1ee6eb791
MD5 518ff8a791d0b260f2ad8a3e2451619e
BLAKE2b-256 5457f1c0ac1828a2f47a1618865e49b0909b5022059e0c4e20fb7ecbfb882efa

See more details on using hashes here.

File details

Details for the file duro_rest-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: duro_rest-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.4 Linux/6.2.0-37-generic

File hashes

Hashes for duro_rest-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 5a2c2f5c933e514b8526df04e7a657a5e0d715a68a4aacfc35c516272b975c3c
MD5 60ae194e2f37cd331ea5e50a3926bf45
BLAKE2b-256 059be3b6add8b70471391a41113c23144edd95a88d31ccb6e34b97889426e5d5

See more details on using hashes here.

Supported by

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