Skip to main content

Mouser Python API

Project description

Mouser Python API

License: MIT Python Versions PyPI Style | Tests

Setup

Requirements

  • Tested with Python 3.8+
  • 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.

:warning: Using the mouser_api_keys.yaml file method, make sure to run mouser commands in the same folder!

The keys will be automatically loaded for each API request.

Install

Pip

pip install mouser

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

Run

Pip

mouser

Manually

python mouser_cli.py

Poetry

poetry run 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.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

mouser-0.1.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mouser-0.1.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for mouser-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1628574eceae806e0e3d9d94c1b1d241d5b4520565b26365dc8f2f11570a0b3c
MD5 613f0916b4dde817de07394719e1b37e
BLAKE2b-256 249a85039fd4252e220de583b605d71627481ff954f49b936e7b4ff70bf16fa9

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: mouser-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.90.1-microsoft-standard-WSL2

File hashes

Hashes for mouser-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 844f6c4b282e199b32252228cc902532a9b4e08650ba6068a7f17cf4019b1a1a
MD5 0f37f49abf8b31a0e944159c4a7bd5b0
BLAKE2b-256 3eaa800b67dc1fb7d2a46f2db35747656b0463ba7e115259b3c2c453f755e721

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