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_KEY
andMOUSER_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 runmouser
commands 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
poetry
package: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
File details
Details for the file mouser-0.1.3.tar.gz
.
File metadata
- Download URL: mouser-0.1.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.6 Linux/5.19.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42e43b17e797bfc2b7a8323585ad8e772a8ba69d58439021635945cc0869cd5f |
|
MD5 | eb8511a26ed5444f5e8dae5331fc9f22 |
|
BLAKE2b-256 | bff6499659bf6715e844258406e575c312058b258cb81b06c39bb1a5b346e919 |
Provenance
File details
Details for the file mouser-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: mouser-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.6 Linux/5.19.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5537acb61c0f9a84da3303b133abdc525fe1d0a8dcf562135182991fab7e0447 |
|
MD5 | c318ad14b1c76629a2bbe91d2012b5ae |
|
BLAKE2b-256 | e715fa9723b5b8555ecc9b2549c86065fb360d44b0bf45db9bb30b730f70038e |