Skip to main content

Mouser Python API

Project description

Mouser Python API

License: MIT Python Versions Style | Tests

Setup

Requirements

  • Tested with Python 3.7+
  • Dependencies: click and requests packages

Mouser API Keys

Mouser provides two separate API keys:

  • one for the cart and orders
  • one for part searches.

Go to Mouser's API hub to request the keys.

To store the keys, two options:

  • create two environmental variables MOUSER_ORDER_API_KEY and MOUSER_PART_API_KEY with the respective values of each key
  • create a file named mouser_api_keys.yaml with the order API key on the first line and the part API key on a second line.

The keys will be automatically loaded for each API request.

Install

Manually

  1. Create virtual environment and activate it
  2. Run pip install -r requirements.txt

Poetry

  1. Install poetry package: pip install poetry
  2. Run poetry install

Pip

WARNING: This procedure installs from TestPyPI (PyPI is pending)

pip install --index-url https://test.pypi.org/simple/ mouser

Run

Manually

python mouser_cli.py

Poetry

poetry run mouser

Pip

mouser

Usage

This command line tool reflects the usage from Mouser's API structure documented here.
The first positional argument is the category of the request: cart (for MouserCart), order, history (for MouserOrderHistory) and search (for SearchAPI). The second argument is the type of operation from the list of operations for each category.

Run mouser --help for more information about the usage.

Examples

The examples below assume this package was installed using Pip (for more options, see above)

Part Number Search

mouser search partnumber --number XXX

Export order to CSV

mouser order get --number XXX --export

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

mouser-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

mouser-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file mouser-0.1.0.tar.gz.

File metadata

  • Download URL: mouser-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.10 Linux/5.11.0-27-generic

File hashes

Hashes for mouser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ba0a57f2362bf1d59a4b17dfa9e87817adfad58e6c748a07c227ad27d73facc1
MD5 5c931d700032866664dbd8f418743942
BLAKE2b-256 7a59fa64932caa205815abebfcaa32264a69a08ae9e0a560e51840448cf98e2a

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: mouser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.10 Linux/5.11.0-27-generic

File hashes

Hashes for mouser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7c91fbbc46b60261d386999a3cdf1008c05d84dbb5340617244ac944dd58d20
MD5 16b6845da9c75589edabac69fba3d668
BLAKE2b-256 4c1b0f9b9929bd863bc439b67e768131711e099798fd935ce176cb7addce4d9a

See more details on using hashes here.

Provenance

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