Skip to main content

ReductStore Client SDK for Python

Project description

ReductStore Client SDK for Python

PyPI PyPI - Downloads GitHub Workflow Status

This package provides an asynchronous HTTP client for interacting with ReductStore in Python.

Features

  • Supports the ReductStore HTTP API v1.12
  • Bucket management
  • API Token management
  • Write, read and query data
  • Labeling records
  • Batching records for read and write operations
  • Subscription
  • Replication management

Install

To install this package, run the following command:

pip install reduct-py

Example

Here is an example of how to use this package to create a bucket, write data to it, and read data from it:

from reduct import Client, BucketSettings, QuotaType


async def main():
    # 1. Create a ReductStore client
    async with Client("http://localhost:8383", api_token="my-token") as client:
        # 2. Get or create a bucket with 1Gb quota
        bucket = await client.create_bucket(
            "my-bucket",
            BucketSettings(quota_type=QuotaType.FIFO, quota_size=1_000_000_000),
            exist_ok=True,
        )

        # 3. Write some data with timestamps in the 'entry-1' entry
        await bucket.write("sensor-1", b"Record #1", timestamp="2024-01-01T10:00:00Z")
        await bucket.write("sensor-1", b"Record #2", timestamp="2024-01-01T10:00:01Z")

        # 4. Query the data by time range
        async for record in bucket.query("sensor-1",
                                         start="2024-01-01T10:00:00Z",
                                         end="2024-01-01T10:00:02Z"):
            print(f"Record timestamp: {record.timestamp}")
            print(f"Record size: {record.size}")
            print(await record.read_all())


# 5. Run the main function
if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

For more examples, see the Guides section in the ReductStore documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

reduct_py-1.12.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file reduct_py-1.12.0-py3-none-any.whl.

File metadata

  • Download URL: reduct_py-1.12.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for reduct_py-1.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21830f7ae5dfa9f54e34421ef164800fad152e744a10401a31bf434294ab2d98
MD5 89482245834facd8c6cbdab63549b9ff
BLAKE2b-256 bb56031027dbe27316c51133ae452b5a465bd7b9805ec12b7aebc2f4b6ed2c7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page