Skip to main content

A simple package to implement the Octopart API version 3

Project description

Octocruncher V3

Use this to query Octopart using the v3 API

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 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

.getNumItems():

This tells you how many results there are

.setItemNumber(itemnumber=0)

This sets the working item for all other functions

.getMPN():

Returns working manufacturer part number

.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-v3-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

octocruncher_v3-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file octocruncher-v3-0.1.0.tar.gz.

File metadata

  • Download URL: octocruncher-v3-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

File hashes

Hashes for octocruncher-v3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9eb6389a09a9aba2feb521791167b3d1ec75a70b84a63f2e02ffee42b7b327ce
MD5 4dd168bb7ae6f24d93ee82e348ae460a
BLAKE2b-256 7e2a70604267c98d462008bf95a3d1363ddfc8192d9b547aad6718088d592318

See more details on using hashes here.

File details

Details for the file octocruncher_v3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: octocruncher_v3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

File hashes

Hashes for octocruncher_v3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f04e31d0fdfce108725a9a666dba04e68e30d1ac3b783e399f084772af81f812
MD5 30e374f40fc6e63f8b690e4e4558fdf3
BLAKE2b-256 ded8fa7ed4968d3024ec4aa5c725d9a0bd3c9068c6302ada0ba9733d7b6138fd

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