A simple package to implement the Octopart API
Project description
Octocruncher
Use this to query Octopart
To function with active requests, the OCTOPART_API_KEY environment variable must be set. This can be done in your Python using the following:
import os
os.environ['OCTOPART_API_KEY'] = 'xxxxxxxxx'
Usage
from octocruncher.octocruncher import OctoCruncher
# Setup the manufacturer part number here
x = OctoCruncher(mpn='mpn')
OctoCruncher takes in the argument 'mpn' (manufacturer part number) which everything else is based off of. Other optional arguments:
json_source: You can provide a json.loads object instead of querying online. This is helpful for when you want to cache (use with OctoCruncher.getJSON())
file_source: Similar to json_source but will load from the given file path
Callables
.getJSON():
This will return a json object that can be cached and loaded later
.getNumDescriptions():
Tells you how many available part descriptions there are
.getDescription(n=0):
Returns the nth description. If n is not specified, the 0th
description will be returned. Returntype is a description class which has the
value
and source
elements
.getNumDatasheets():
Tells you how many datasheets are available
.getDatasheet(n=0)
Returns the nth Datasheet object. This object has the following parameters that can be accessed:
date_created
last_updated
num_pages
size_bytes
date_created
mimetype
url
source
.getManufacturer():
This returns a manufacturer object with the name
and homepage_url
attributes
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
Built Distribution
Hashes for octocruncher-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1abe5037ebe8e35b43620c40d3d7fd3f87b991d9b1a7f48636c4a917828b785 |
|
MD5 | bcd05e857ca092b511c01719e2b2cc76 |
|
BLAKE2b-256 | 6e6709c47edc30f52a9093ebc5a6b47d0c2420f76b5cff833ea5990a53d0e072 |