mouser


Namemouser JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/sparkmicro/mouser-api
SummaryMouser Python API
upload_time2023-08-24 19:01:24
maintainereeintech
docs_urlNone
authoreeintech
requires_python>=3.8,<4.0
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": ">=3.8,<4.0",
    "maintainer_email": "eeintech@eeinte.ch",
    "keywords": "mouser,api,python",
    "author": "eeintech",
    "author_email": "eeintech@eeinte.ch",
    "download_url": "https://files.pythonhosted.org/packages/24/9a/85039fd4252e220de583b605d71627481ff954f49b936e7b4ff70bf16fa9/mouser-0.1.5.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.5",
    "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": "3eaa800b67dc1fb7d2a46f2db35747656b0463ba7e115259b3c2c453f755e721",
                "md5": "0f37f49abf8b31a0e944159c4a7bd5b0",
                "sha256": "844f6c4b282e199b32252228cc902532a9b4e08650ba6068a7f17cf4019b1a1a"
            },
            "downloads": -1,
            "filename": "mouser-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f37f49abf8b31a0e944159c4a7bd5b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 7076,
            "upload_time": "2023-08-24T19:01:22",
            "upload_time_iso_8601": "2023-08-24T19:01:22.700394Z",
            "url": "https://files.pythonhosted.org/packages/3e/aa/800b67dc1fb7d2a46f2db35747656b0463ba7e115259b3c2c453f755e721/mouser-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "249a85039fd4252e220de583b605d71627481ff954f49b936e7b4ff70bf16fa9",
                "md5": "613f0916b4dde817de07394719e1b37e",
                "sha256": "1628574eceae806e0e3d9d94c1b1d241d5b4520565b26365dc8f2f11570a0b3c"
            },
            "downloads": -1,
            "filename": "mouser-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "613f0916b4dde817de07394719e1b37e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5633,
            "upload_time": "2023-08-24T19:01:24",
            "upload_time_iso_8601": "2023-08-24T19:01:24.240679Z",
            "url": "https://files.pythonhosted.org/packages/24/9a/85039fd4252e220de583b605d71627481ff954f49b936e7b4ff70bf16fa9/mouser-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-24 19:01:24",
    "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.10542s