Mouser Python API
Project description
Mouser Python API
Setup
Requirements
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_KEYandMOUSER_PART_API_KEYwith the respective values of each key - create a file named
mouser_api_keys.yamlwith the order API key on the first line and the part API key on a second line.
:warning: Using the
mouser_api_keys.yamlfile method, make sure to runmousercommands in the same folder!
The keys will be automatically loaded for each API request.
Install
Pip
pip install mouser
Manually
- Create virtual environment and activate it
- Run
pip install -r requirements.txt
Poetry
- Install
poetrypackage:pip install poetry - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mouser-0.1.6.tar.gz.
File metadata
- Download URL: mouser-0.1.6.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
164c6ff6145f519fc60963724a23e8fb10741322b8934a0fea72d2e25a119328
|
|
| MD5 |
0a1ef2fe8981cc55da0c4e1de912493e
|
|
| BLAKE2b-256 |
9eddadf6a4040e5493d8c36f2c19d4f506b630c9cda4f6969a03d7e279855e1b
|
File details
Details for the file mouser-0.1.6-py3-none-any.whl.
File metadata
- Download URL: mouser-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df2d709e768dca64c05a1ba7fe1708c054444b5766bd0741757707e5808293a0
|
|
| MD5 |
bc575c0482eff83796296b702debcec8
|
|
| BLAKE2b-256 |
b545a6690b1836adb799076892a733ad507f7ca117b465cffeb642e906510d5b
|