Skip to main content

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


Download files

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

Source Distribution

octocruncher-0.0.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

octocruncher-0.0.5-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file octocruncher-0.0.5.tar.gz.

File metadata

  • Download URL: octocruncher-0.0.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for octocruncher-0.0.5.tar.gz
Algorithm Hash digest
SHA256 36aa22c0041622df15f3f32a003c6e1327b14fb662bb3598fdb2399d298b97b1
MD5 e66ab58828d90cd8ab372248b1cd3811
BLAKE2b-256 807f4eae58ed5ed46ca7dca0c3d5846f9aaf7584d32e09555a192ab107f6e2b8

See more details on using hashes here.

File details

Details for the file octocruncher-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: octocruncher-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for octocruncher-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dae167a3d04d70a45cf859b9ec5556a2de3018f1f0e628c83b39cb498cae8601
MD5 ad72f24b71a6aa4eec2340e5b0d0980c
BLAKE2b-256 39f57d1d83eb15ae2e2b7ef5065859ee01ecd91d92a3dc94ab58df3946345e8b

See more details on using hashes here.

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