Skip to main content

Python client for Digikey API

Project description

Python Client for Digikey PartSearch API v2

Search for parts in the Digi-Key catalog by keyword using KeywordSearch. Then make a PartDetails call to retrieve all real time information about the part including pricing. PartDetails works best with Digi-Key part numbers as some manufacturers overlap other manufacturer part numbers.

Pypi Donate

What does it do

digkey-api is an Digkey Part Search API client for Python 3.6+. API response data is returned as Python objects that attempt to make it easy to get the data you want. Not all endpoints have been implemented.

Quickstart

Register

Register an app on the Digikey API portal: Digi-Key API. You will need the client ID and the client secret to use the API. You will also need a Digi-Key account to authenticate, using the Oauth2 process.

Install

pip install digikey-api

export DIGIKEY_CLIENT_ID="client_id"
export DIGIKEY_CLIENT_SECRET="client_secret"
export DIGIKEY_STORAGE_PATH="cache_dir"

Use

Python will automatically spawn a browser to allow you to authenticate using the Oauth2 process. After obtaining a token the library will cache the access token and use the refresh token to automatically refresh your credentials.

import os
import digikey

os.environ['DIGIKEY_CLIENT_ID'] = 'client_id'
os.environ['DIGIKEY_CLIENT_SECRET'] = 'client_secret'
os.environ['DIGIKEY_STORAGE_PATH'] = 'cache_dir'

dkpn = '296-6501-1-ND'
part = digikey.part(dkpn)
print(part)
# <Part mpn=NE555DR>

print(part.manufacturer)
# 'Texas Instruments'

Test

python -m pytest --cov=digikey --doctest-modules --ignore=setup.py
python -m mypy digikey --ignore-missing-imports

Top-level API

  • digikey.search()
  • digikey.part()

Data models

  • digikey.models.KeywordSearchResult
  • digikey.models.Part

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

digikey-api-0.3.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

digikey_api-0.3.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file digikey-api-0.3.0.tar.gz.

File metadata

  • Download URL: digikey-api-0.3.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for digikey-api-0.3.0.tar.gz
Algorithm Hash digest
SHA256 87cff4eb1aa4b74d7e73e01a86e1934474a4bc72f08f3454ede36803cb3d3be0
MD5 4bfc335d15877930a2c1f20010e8fc5a
BLAKE2b-256 b4e70b4c9e12099138b40ceb0086329b92115401ee97108b0b72298980e22b23

See more details on using hashes here.

File details

Details for the file digikey_api-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: digikey_api-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.5 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/47.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for digikey_api-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77ba68836caca7a6d46f7c0f86bb75a87750682c160426db6ec008a0585627b3
MD5 fea88f4228a91a4515ee80c2884a919b
BLAKE2b-256 54a7f8ab71f5424d3ed9210b968185a3160053ccc00f6611de2f442963b6ad1f

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