span-panel


Namespan-panel JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummaryUnofficial SPAN Panel Python API and CLI
upload_time2024-03-19 03:52:36
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT
keywords home assistant home automation python span span panel
VCS
bugtrack_url
requirements aenum aiohttp aiosignal attrs click frozenlist idna markdown-it-py mdurl multidict orjson pydantic pygments python-dateutil rich six typer typing-extensions urllib3 yarl
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Unofficial SPAN Panel Python API and CLI

[![Latest PyPI version](https://img.shields.io/pypi/v/span-panel)](https://pypi.org/project/span-panel/) [![Supported Python](https://img.shields.io/pypi/pyversions/span-panel)](https://pypi.org/project/span-panel/) [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![CI](https://github.com/AngellusMortis/span-panel/actions/workflows/ci.yaml/badge.svg)](https://github.com/AngellusMortis/span-panel/actions/workflows/ci.yaml) [![Documentation](https://github.com/AngellusMortis/span-panel/actions/workflows/pages/pages-build-deployment/badge.svg)](https://angellusmortis.github.io/span-panel/)

`span-panel` is an unofficial API for the [SPAN Smart Panel](https://www.span.io/panel). There is no affiliation with SPAN.

## Documentation

[Full documentation for the project](https://angellusmortis.github.io/span-panel/).

## Requirements

* A [SPAN Smart Panel](https://www.span.io/panel).
    * Latest version of library is generally only tested against the latest firmware version.
* [Python](https://www.python.org/) 3.9+
* POSIX compatible system
    * Library is only test on Linux, specifically the latest Debian version available for the official Python Docker images, but there is no reason the library should not work on any Linux distro or MacOS.

Alternatively you can use the [provided Docker container](#using-docker-container), in which case the only requirement is [Docker](https://docs.docker.com/desktop/) or another OCI compatible orchestrator (such as Kubernetes or podman).

Windows is **not supported**. If you need to use `span-panel` on Windows, use Docker Desktop and the provided docker container or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install).

## Install

### From PyPi

`span-panel` is available on PyPi:

```bash
pip install span-panel
```

### From Github

```bash
pip install git+https://github.com/AngellusMortis/span-panel.git#egg=span-panel
```

### Using Docker Container

A Docker container is also provided so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.

```bash
function span-panel() {
    docker run --rm -it \
      -e SPAN_HOST=http://your_span_ip \
      -e SPAN_TOKEN=your_token \
      ghcr.io/angellusmortis/span-panel:latest "$@"
}
```

Some notes about the Docker version since it is running inside of a container:

* You can update at any time using the command `docker pull ghcr.io/AngellusMortis/span-panel:latest`
* The container supports `linux/amd64` and `linux/arm64` natively. This means it will also work well on MacOS or Windows using Docker Desktop.

## Quickstart

### Getting an Auth Token

Before being able to do anything, you need to get an auth token from your SPAN Panel. The `generate-token` subcommand will walk you through how.

```bash
export SPAN_HOST=http://your_span_ip

span-panel generate-token
```

### CLI

```bash
export SPAN_HOST=http://your_span_ip
export SPAN_TOKEN=your_token

span-panel --help
span-panel panel meter
span-panel circuits list-ids
```

### Python

`span-panel` itself is 100% async, so as such this library is primarily designed to be used in an async context.

The main interface for the library is the `span_panel.SpanClient`:

```python
import asyncio

from span_panel import SpanClient


client = SpanClient(host=host, token=token)

async def main():
    return await client.get_circuits()

for circuit_id, circuit in asyncio.run(main()).circuits:
    # do stuff
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "span-panel",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Christopher Bailey <cbailey@mort.is>",
    "keywords": "Home Assistant,Home Automation,Python,SPAN,SPAN Panel",
    "author": "",
    "author_email": "Christopher Bailey <cbailey@mort.is>",
    "download_url": "https://files.pythonhosted.org/packages/8a/6a/92369cd654bd90c0b5e22b1967a3a1d8a80f99bebd8a9daa557309fa7503/span_panel-0.2.1.tar.gz",
    "platform": null,
    "description": "# Unofficial SPAN Panel Python API and CLI\n\n[![Latest PyPI version](https://img.shields.io/pypi/v/span-panel)](https://pypi.org/project/span-panel/) [![Supported Python](https://img.shields.io/pypi/pyversions/span-panel)](https://pypi.org/project/span-panel/) [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![CI](https://github.com/AngellusMortis/span-panel/actions/workflows/ci.yaml/badge.svg)](https://github.com/AngellusMortis/span-panel/actions/workflows/ci.yaml) [![Documentation](https://github.com/AngellusMortis/span-panel/actions/workflows/pages/pages-build-deployment/badge.svg)](https://angellusmortis.github.io/span-panel/)\n\n`span-panel` is an unofficial API for the [SPAN Smart Panel](https://www.span.io/panel). There is no affiliation with SPAN.\n\n## Documentation\n\n[Full documentation for the project](https://angellusmortis.github.io/span-panel/).\n\n## Requirements\n\n* A [SPAN Smart Panel](https://www.span.io/panel).\n    * Latest version of library is generally only tested against the latest firmware version.\n* [Python](https://www.python.org/) 3.9+\n* POSIX compatible system\n    * Library is only test on Linux, specifically the latest Debian version available for the official Python Docker images, but there is no reason the library should not work on any Linux distro or MacOS.\n\nAlternatively you can use the [provided Docker container](#using-docker-container), in which case the only requirement is [Docker](https://docs.docker.com/desktop/) or another OCI compatible orchestrator (such as Kubernetes or podman).\n\nWindows is **not supported**. If you need to use `span-panel` on Windows, use Docker Desktop and the provided docker container or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install).\n\n## Install\n\n### From PyPi\n\n`span-panel` is available on PyPi:\n\n```bash\npip install span-panel\n```\n\n### From Github\n\n```bash\npip install git+https://github.com/AngellusMortis/span-panel.git#egg=span-panel\n```\n\n### Using Docker Container\n\nA Docker container is also provided so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.\n\n```bash\nfunction span-panel() {\n    docker run --rm -it \\\n      -e SPAN_HOST=http://your_span_ip \\\n      -e SPAN_TOKEN=your_token \\\n      ghcr.io/angellusmortis/span-panel:latest \"$@\"\n}\n```\n\nSome notes about the Docker version since it is running inside of a container:\n\n* You can update at any time using the command `docker pull ghcr.io/AngellusMortis/span-panel:latest`\n* The container supports `linux/amd64` and `linux/arm64` natively. This means it will also work well on MacOS or Windows using Docker Desktop.\n\n## Quickstart\n\n### Getting an Auth Token\n\nBefore being able to do anything, you need to get an auth token from your SPAN Panel. The `generate-token` subcommand will walk you through how.\n\n```bash\nexport SPAN_HOST=http://your_span_ip\n\nspan-panel generate-token\n```\n\n### CLI\n\n```bash\nexport SPAN_HOST=http://your_span_ip\nexport SPAN_TOKEN=your_token\n\nspan-panel --help\nspan-panel panel meter\nspan-panel circuits list-ids\n```\n\n### Python\n\n`span-panel` itself is 100% async, so as such this library is primarily designed to be used in an async context.\n\nThe main interface for the library is the `span_panel.SpanClient`:\n\n```python\nimport asyncio\n\nfrom span_panel import SpanClient\n\n\nclient = SpanClient(host=host, token=token)\n\nasync def main():\n    return await client.get_circuits()\n\nfor circuit_id, circuit in asyncio.run(main()).circuits:\n    # do stuff\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Unofficial SPAN Panel Python API and CLI",
    "version": "0.2.1",
    "project_urls": {
        "Bug Reports": "https://github.com/AngellusMortis/span-panel/issues/",
        "Changelog": "https://github.com/AngellusMortis/span-panel/releases/",
        "Documentation": "https://angellusmortis.github.io/span-panel/latest/",
        "Source Code": "https://github.com/AngellusMortis/span-panel/"
    },
    "split_keywords": [
        "home assistant",
        "home automation",
        "python",
        "span",
        "span panel"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "969624337572b524f9a65cab31abdd5f287af200d1f59b3dcdb19c7ad9a0e6c9",
                "md5": "9ff743839fcadb879a989a525b94cc20",
                "sha256": "a829db05028131135214bdac702428b6080be3be487a6183a2e8073998648559"
            },
            "downloads": -1,
            "filename": "span_panel-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ff743839fcadb879a989a525b94cc20",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 100883,
            "upload_time": "2024-03-19T03:52:32",
            "upload_time_iso_8601": "2024-03-19T03:52:32.104806Z",
            "url": "https://files.pythonhosted.org/packages/96/96/24337572b524f9a65cab31abdd5f287af200d1f59b3dcdb19c7ad9a0e6c9/span_panel-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a6a92369cd654bd90c0b5e22b1967a3a1d8a80f99bebd8a9daa557309fa7503",
                "md5": "4a9a4d3c8e0ec2df974272683b06b041",
                "sha256": "f3b2a5c3b6489b82c9e514b805809f1da661830f2467371a60a20a59edf4c517"
            },
            "downloads": -1,
            "filename": "span_panel-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4a9a4d3c8e0ec2df974272683b06b041",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 48247,
            "upload_time": "2024-03-19T03:52:36",
            "upload_time_iso_8601": "2024-03-19T03:52:36.695733Z",
            "url": "https://files.pythonhosted.org/packages/8a/6a/92369cd654bd90c0b5e22b1967a3a1d8a80f99bebd8a9daa557309fa7503/span_panel-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-19 03:52:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AngellusMortis",
    "github_project": "span-panel",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aenum",
            "specs": [
                [
                    "==",
                    "3.1.15"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.9.3"
                ]
            ]
        },
        {
            "name": "aiosignal",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "23.2.0"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.7"
                ]
            ]
        },
        {
            "name": "frozenlist",
            "specs": [
                [
                    "==",
                    "1.4.1"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.6"
                ]
            ]
        },
        {
            "name": "markdown-it-py",
            "specs": [
                [
                    "==",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "mdurl",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "multidict",
            "specs": [
                [
                    "==",
                    "6.0.5"
                ]
            ]
        },
        {
            "name": "orjson",
            "specs": [
                [
                    "==",
                    "3.9.15"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "==",
                    "1.10.14"
                ]
            ]
        },
        {
            "name": "pygments",
            "specs": [
                [
                    "==",
                    "2.17.2"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "13.7.1"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "typer",
            "specs": [
                [
                    "==",
                    "0.9.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.10.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.1"
                ]
            ]
        },
        {
            "name": "yarl",
            "specs": [
                [
                    "==",
                    "1.9.4"
                ]
            ]
        }
    ],
    "lcname": "span-panel"
}
        
Elapsed time: 0.20434s