matildapeak-scoly-api


Namematildapeak-scoly-api JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryThe Scoly API Package
upload_time2023-06-11 21:44:23
maintainer
docs_urlNone
authorAlan Christie
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Scoly API

[![Latest Release](https://gitlab.com/matilda.peak/scoly-api/-/badges/release.svg)](https://gitlab.com/matilda.peak/scoly-api/-/releases)

[![pipeline status](https://gitlab.com/matilda.peak/scoly-api/badges/main/pipeline.svg)](https://gitlab.com/matilda.peak/scoly-api/-/commits/main)
[![coverage report](https://gitlab.com/matilda.peak/scoly-api/badges/main/coverage.svg)](https://gitlab.com/matilda.peak/scoly-api/-/commits/main)

[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Packaged with Poetry](https://img.shields.io/badge/packaging-poetry-cyan.svg)](https://python-poetry.org)

A Python 3 API package for the [Scoly] framework.

## Usage
Create a `ScolyAPI` instance for each **Location** you're dealing with: -

    from scoly_api.client import Scoly
    from datetime import datetime
    client = Scoly(
        scoly_url="127.0.0.1:8000",
        location="Red Dwarf",
        location_api_access_code="033589a1-c17d-45e0-bbaa-a5122300c9f3",
    )

And then add sensor events, which will be transmitted to **Scoly** when the
cache is full: -

    client.add_sensor_data(
        sensor="Rimmer",
        data={"timestamp": "2023-05-30T00:00:00Z",
              "battery": 67,
              "presence": False,
              "celsius": 23.4,
              "lux": 45.6}
    )

By default the cache will be flushed when it contains 50 events or if the
cache contents are older than 6 minutes. You can set your own
values when you initialise the `ScolyAPI` instance with some extra parameters.
To set a cache size of 10 and maximum age of 2 minutes initialise the ScolyAPI
instance like this: -

    client = Scoly(
        [...],
        sensor_event_cache_size = 10,
        sensor_event_cache_period = 120,
    )

If either value is zero sensor data will be transmitted on each call to
`add_sensor_data()`.

There is no background task. After 6 minutes events will not be transmitted,
instead they will b e transmitted on the next call to `add_sensor_data()`.
Alternatively, you can also flush cached data immediately by calling `flush()`: -

    client.flush()

## Building
The project is managed by [Poetry], so you can build and install the project
forcing version 1.0.0 with: -

    rm -rf dist
    poetry version 1.0.0
    poetry build

And then install locally with `pip`: -

    pip install dist/*.whl

When you're done you can uninstall the API package with pip: -

    pip uninstall -y matildapeak_scoly_api

## Contributing
The project uses: -

- [Poetry] for dependency management and packaging
- [Pre-commit] to enforce linting of files prior to committing them to the
  upstream repository
- [Conventional Commits] commit message format
- [Black] as a code formatter

You **MUST** comply with these choices in order to  contribute to the project.

To get started review the pre-commit utility and the conventional commit style
and then set-up your local clone by following the **Installation** and
**Quick Start** sections: -

    poetry shell
    poetry install --with dev
    pre-commit install -t commit-msg -t pre-commit

Now the project's rules will run on every commit, and you can check the
current health of your clone with: -

    pre-commit run --all-files

---

[black]: https://black.readthedocs.io/en/stable
[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/
[poetry]: https://python-poetry.org
[pre-commit]: https://pre-commit.com
[scoly]: https://gitlab.com/matilda.peak/scoly

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "matildapeak-scoly-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alan Christie",
    "author_email": "alan.christie@matildapeak.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/98/abd535b469b3cb571a6d8e759c11102088073b4298f2588cd2aa7085e60d/matildapeak_scoly_api-1.0.1.tar.gz",
    "platform": null,
    "description": "# Scoly API\n\n[![Latest Release](https://gitlab.com/matilda.peak/scoly-api/-/badges/release.svg)](https://gitlab.com/matilda.peak/scoly-api/-/releases)\n\n[![pipeline status](https://gitlab.com/matilda.peak/scoly-api/badges/main/pipeline.svg)](https://gitlab.com/matilda.peak/scoly-api/-/commits/main)\n[![coverage report](https://gitlab.com/matilda.peak/scoly-api/badges/main/coverage.svg)](https://gitlab.com/matilda.peak/scoly-api/-/commits/main)\n\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Packaged with Poetry](https://img.shields.io/badge/packaging-poetry-cyan.svg)](https://python-poetry.org)\n\nA Python 3 API package for the [Scoly] framework.\n\n## Usage\nCreate a `ScolyAPI` instance for each **Location** you're dealing with: -\n\n    from scoly_api.client import Scoly\n    from datetime import datetime\n    client = Scoly(\n        scoly_url=\"127.0.0.1:8000\",\n        location=\"Red Dwarf\",\n        location_api_access_code=\"033589a1-c17d-45e0-bbaa-a5122300c9f3\",\n    )\n\nAnd then add sensor events, which will be transmitted to **Scoly** when the\ncache is full: -\n\n    client.add_sensor_data(\n        sensor=\"Rimmer\",\n        data={\"timestamp\": \"2023-05-30T00:00:00Z\",\n              \"battery\": 67,\n              \"presence\": False,\n              \"celsius\": 23.4,\n              \"lux\": 45.6}\n    )\n\nBy default the cache will be flushed when it contains 50 events or if the\ncache contents are older than 6 minutes. You can set your own\nvalues when you initialise the `ScolyAPI` instance with some extra parameters.\nTo set a cache size of 10 and maximum age of 2 minutes initialise the ScolyAPI\ninstance like this: -\n\n    client = Scoly(\n        [...],\n        sensor_event_cache_size = 10,\n        sensor_event_cache_period = 120,\n    )\n\nIf either value is zero sensor data will be transmitted on each call to\n`add_sensor_data()`.\n\nThere is no background task. After 6 minutes events will not be transmitted,\ninstead they will b e transmitted on the next call to `add_sensor_data()`.\nAlternatively, you can also flush cached data immediately by calling `flush()`: -\n\n    client.flush()\n\n## Building\nThe project is managed by [Poetry], so you can build and install the project\nforcing version 1.0.0 with: -\n\n    rm -rf dist\n    poetry version 1.0.0\n    poetry build\n\nAnd then install locally with `pip`: -\n\n    pip install dist/*.whl\n\nWhen you're done you can uninstall the API package with pip: -\n\n    pip uninstall -y matildapeak_scoly_api\n\n## Contributing\nThe project uses: -\n\n- [Poetry] for dependency management and packaging\n- [Pre-commit] to enforce linting of files prior to committing them to the\n  upstream repository\n- [Conventional Commits] commit message format\n- [Black] as a code formatter\n\nYou **MUST** comply with these choices in order to  contribute to the project.\n\nTo get started review the pre-commit utility and the conventional commit style\nand then set-up your local clone by following the **Installation** and\n**Quick Start** sections: -\n\n    poetry shell\n    poetry install --with dev\n    pre-commit install -t commit-msg -t pre-commit\n\nNow the project's rules will run on every commit, and you can check the\ncurrent health of your clone with: -\n\n    pre-commit run --all-files\n\n---\n\n[black]: https://black.readthedocs.io/en/stable\n[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/\n[poetry]: https://python-poetry.org\n[pre-commit]: https://pre-commit.com\n[scoly]: https://gitlab.com/matilda.peak/scoly\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "The Scoly API Package",
    "version": "1.0.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08ed9d0178a1c3ffd58ac63a6d51ef99ca653a87d5678f68005918172436f5c0",
                "md5": "36acb8bfc3ba41efcbf487207b9133a8",
                "sha256": "2f7ca846e3bc073a04f9001b4603cdd9698d4e398d01db7d524aafe1e2d5d4e0"
            },
            "downloads": -1,
            "filename": "matildapeak_scoly_api-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "36acb8bfc3ba41efcbf487207b9133a8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4197,
            "upload_time": "2023-06-11T21:44:21",
            "upload_time_iso_8601": "2023-06-11T21:44:21.802269Z",
            "url": "https://files.pythonhosted.org/packages/08/ed/9d0178a1c3ffd58ac63a6d51ef99ca653a87d5678f68005918172436f5c0/matildapeak_scoly_api-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d98abd535b469b3cb571a6d8e759c11102088073b4298f2588cd2aa7085e60d",
                "md5": "e2b0560f927433841875c81b55a92014",
                "sha256": "003622a26b3f4fd559b740c0952abcf0b380f8803a6e68b933b866fc8f366f72"
            },
            "downloads": -1,
            "filename": "matildapeak_scoly_api-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e2b0560f927433841875c81b55a92014",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3943,
            "upload_time": "2023-06-11T21:44:23",
            "upload_time_iso_8601": "2023-06-11T21:44:23.316843Z",
            "url": "https://files.pythonhosted.org/packages/9d/98/abd535b469b3cb571a6d8e759c11102088073b4298f2588cd2aa7085e60d/matildapeak_scoly_api-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-11 21:44:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "matildapeak-scoly-api"
}
        
Elapsed time: 0.12181s