mouser


Namemouser JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/sparkmicro/mouser-api
SummaryMouser Python API
upload_time2024-10-01 18:11:33
maintainereeintech
docs_urlNone
authoreeintech
requires_python<4.0,>=3.8
licenseMIT
keywords mouser api python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mouser Python API

[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/sparkmicro/mouser-api/blob/main/LICENSE)
[![Python Versions](https://raw.githubusercontent.com/sparkmicro/Ki-nTree/master/images/python_versions.svg)](https://www.python.org/)
[![PyPI](https://img.shields.io/pypi/v/mouser)](https://pypi.org/project/mouser/)
[![Style | Tests](https://github.com/sparkmicro/mouser-api/actions/workflows/tests.yaml/badge.svg)](https://github.com/sparkmicro/mouser-api/actions)

## Setup

### Requirements

* Tested with Python 3.8+
* Dependencies: [click](https://click.palletsprojects.com/en/8.0.x/) and [requests](https://docs.python-requests.org/en/master/) 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](https://www.mouser.com/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

``` bash
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

```bash
mouser
```

#### Manually

```bash
python mouser_cli.py
```

#### Poetry

```bash
poetry run mouser
```

## Usage

This command line tool reflects the usage from Mouser's API structure [documented here](https://api.mouser.com/api/docs/ui/index#/).  
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](#run))

#### Part Number Search
```bash
mouser search partnumber --number XXX
```

#### Export order to CSV
``` bash
mouser order get --number XXX --export
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sparkmicro/mouser-api",
    "name": "mouser",
    "maintainer": "eeintech",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "eeintech@eeinte.ch",
    "keywords": "mouser, api, python",
    "author": "eeintech",
    "author_email": "eeintech@eeinte.ch",
    "download_url": "https://files.pythonhosted.org/packages/9e/dd/adf6a4040e5493d8c36f2c19d4f506b630c9cda4f6969a03d7e279855e1b/mouser-0.1.6.tar.gz",
    "platform": null,
    "description": "# Mouser Python API\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/sparkmicro/mouser-api/blob/main/LICENSE)\n[![Python Versions](https://raw.githubusercontent.com/sparkmicro/Ki-nTree/master/images/python_versions.svg)](https://www.python.org/)\n[![PyPI](https://img.shields.io/pypi/v/mouser)](https://pypi.org/project/mouser/)\n[![Style | Tests](https://github.com/sparkmicro/mouser-api/actions/workflows/tests.yaml/badge.svg)](https://github.com/sparkmicro/mouser-api/actions)\n\n## Setup\n\n### Requirements\n\n* Tested with Python 3.8+\n* Dependencies: [click](https://click.palletsprojects.com/en/8.0.x/) and [requests](https://docs.python-requests.org/en/master/) packages\n\n### Mouser API Keys\n\nMouser provides two separate API keys:\n* one for the cart and orders\n* one for part searches.\n\nGo to [Mouser's API hub](https://www.mouser.com/api-hub/) to request the keys.\n\nTo store the keys, two options:\n* create two environmental variables `MOUSER_ORDER_API_KEY` and `MOUSER_PART_API_KEY` with the respective values of each key\n* 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.\n\n> :warning: Using the `mouser_api_keys.yaml` file method, make sure to run `mouser` commands in the same folder!\n\nThe keys will be automatically loaded for each API request.\n\n### Install\n\n#### Pip\n\n``` bash\npip install mouser\n```\n\n#### Manually\n\n1. Create virtual environment and activate it\n2. Run `pip install -r requirements.txt`\n\n#### Poetry\n\n1. Install `poetry` package: `pip install poetry`\n2. Run `poetry install`\n\n### Run\n\n#### Pip\n\n```bash\nmouser\n```\n\n#### Manually\n\n```bash\npython mouser_cli.py\n```\n\n#### Poetry\n\n```bash\npoetry run mouser\n```\n\n## Usage\n\nThis command line tool reflects the usage from Mouser's API structure [documented here](https://api.mouser.com/api/docs/ui/index#/).  \nThe first positional argument is the category of the request: cart (for MouserCart), order, history (for MouserOrderHistory) and search (for SearchAPI).\nThe second argument is the type of operation from the list of operations for each category.\n\nRun `mouser --help` for more information about the usage.\n\n### Examples\n> The examples below assume this package was installed using Pip (for more options, see [above](#run))\n\n#### Part Number Search\n```bash\nmouser search partnumber --number XXX\n```\n\n#### Export order to CSV\n``` bash\nmouser order get --number XXX --export\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Mouser Python API",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/sparkmicro/mouser-api",
        "Repository": "https://github.com/sparkmicro/mouser-api"
    },
    "split_keywords": [
        "mouser",
        " api",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b545a6690b1836adb799076892a733ad507f7ca117b465cffeb642e906510d5b",
                "md5": "bc575c0482eff83796296b702debcec8",
                "sha256": "df2d709e768dca64c05a1ba7fe1708c054444b5766bd0741757707e5808293a0"
            },
            "downloads": -1,
            "filename": "mouser-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bc575c0482eff83796296b702debcec8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 7566,
            "upload_time": "2024-10-01T18:11:32",
            "upload_time_iso_8601": "2024-10-01T18:11:32.831950Z",
            "url": "https://files.pythonhosted.org/packages/b5/45/a6690b1836adb799076892a733ad507f7ca117b465cffeb642e906510d5b/mouser-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9eddadf6a4040e5493d8c36f2c19d4f506b630c9cda4f6969a03d7e279855e1b",
                "md5": "0a1ef2fe8981cc55da0c4e1de912493e",
                "sha256": "164c6ff6145f519fc60963724a23e8fb10741322b8934a0fea72d2e25a119328"
            },
            "downloads": -1,
            "filename": "mouser-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "0a1ef2fe8981cc55da0c4e1de912493e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 6111,
            "upload_time": "2024-10-01T18:11:33",
            "upload_time_iso_8601": "2024-10-01T18:11:33.769006Z",
            "url": "https://files.pythonhosted.org/packages/9e/dd/adf6a4040e5493d8c36f2c19d4f506b630c9cda4f6969a03d7e279855e1b/mouser-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-01 18:11:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sparkmicro",
    "github_project": "mouser-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mouser"
}
        
Elapsed time: 0.35993s