Skip to main content

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.

⚠️ 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)

mouser search partnumber --number XXX

Export order to CSV

mouser order get --number XXX --export

Metadata

Release files for mouser 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mouser 0.1.6
File Size Uploaded
mouser-0.1.6.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mouser 0.1.6
File Interpreter ABI Platform
mouser-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / mouser-0.1.6.tar.gz

Download URL mouser-0.1.6.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
164c6ff6145f519fc60963724a23e8fb10741322b8934a0fea72d2e25a119328
BLAKE2b-256 checksum
How to use checksums
9eddadf6a4040e5493d8c36f2c19d4f506b630c9cda4f6969a03d7e279855e1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

Release files / mouser-0.1.6-py3-none-any.whl

Download URL mouser-0.1.6-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df2d709e768dca64c05a1ba7fe1708c054444b5766bd0741757707e5808293a0
BLAKE2b-256 checksum
How to use checksums
b545a6690b1836adb799076892a733ad507f7ca117b465cffeb642e906510d5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page