Skip to main content

Scoly API

Latest Release

pipeline status coverage report

pre-commit Conventional Commits Code style: black Packaged with Poetry

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

Metadata

Release files for matildapeak-scoly-api 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matildapeak-scoly-api 1.0.1
File Size Uploaded
matildapeak_scoly_api-1.0.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matildapeak-scoly-api 1.0.1
File Interpreter ABI Platform
matildapeak_scoly_api-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / matildapeak_scoly_api-1.0.1.tar.gz

Download URL matildapeak_scoly_api-1.0.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
003622a26b3f4fd559b740c0952abcf0b380f8803a6e68b933b866fc8f366f72
BLAKE2b-256 checksum
How to use checksums
9d98abd535b469b3cb571a6d8e759c11102088073b4298f2588cd2aa7085e60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.4.109+

Release files / matildapeak_scoly_api-1.0.1-py3-none-any.whl

Download URL matildapeak_scoly_api-1.0.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f7ca846e3bc073a04f9001b4603cdd9698d4e398d01db7d524aafe1e2d5d4e0
BLAKE2b-256 checksum
How to use checksums
08ed9d0178a1c3ffd58ac63a6d51ef99ca653a87d5678f68005918172436f5c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.4.109+

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page