Skip to main content

Designed to interact with the Milton Keynes' BT DX platform

Project description

BTDX Library

PyPI Latest Release

The btdx library is designed to interact with the Milton Keynes' BT Data Exchange Platform. This README provides a guide on how to install, set up, and effectively use the DX.

Table of Contents

Installation

  • From PyPI (Python Package Index)

    You can install the btdx library using pip. Make sure you have python >= 3.8 and pip installed on your machine, then,:

    pip install btdx
    
  • From source

    To install btdx from source, clone the repository from here. You will also need requests to install btdx. In your terminal type:

    pip install requests
    

    , and then,

    pip install .
    

    or in editable mode

    pip install -e .
    

Usage

To use the btdx, you need to create an instance of DX first. Then use either post method to ingest data or get method to retrieve data

  1. Initialization To create an instance of DX, provide your API key, feed ID, and optionally a version number..

    from btdx import DX  # Make sure to import the DX class from the module
    api_key = "your_api_key"     # Your API key
    feed_id = "your_feed_id"     # The feed ID you want to interact with
    version = 1                  # Optional: Version number (default is 1)
    DX = DX(api_key, feed_id, version)
    
  2. Posting Data You can post data to a specific stream by calling the post method. You need to provide the stream ID and the data you want to post.

    stream_id = "100"           # The ID of the stream you want to post data to
    data =  "AQI: 2"         # The value you want to post
    DX.post(stream_id=stream_id, data=data)
    
  3. Getting Data To retrieve data from a specific stream, use the get method. You can specify the stream ID and whether you want to display the data. You can also pass optional parameters such as agregate.

    stream_id = "100"           # The ID of the stream you want to get data from
    # Retrieve and display data
    DX.get(stream_id=stream_id, display=True)
    # Retrieve last 100 values and display data
    DX.get(stream_id=stream_id, display=True, agregate=True)
    

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Go to Top

Project details


Download files

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

Source Distribution

btdx-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

btdx-0.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file btdx-0.0.1.tar.gz.

File metadata

  • Download URL: btdx-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for btdx-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e808adbe604e0a72d98a24ccde63afc30998f00cd53645f12c3de3351ed5af49
MD5 3d8b20b25b8d16161ed40d887a44de5d
BLAKE2b-256 b308305b04e85d262c344aa913eb772fc4dad178a7ea220f08093c1c6f876706

See more details on using hashes here.

File details

Details for the file btdx-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: btdx-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for btdx-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a328c7864b2e38a2dbf09d40c450f1fcbd6ddce69b427afc051ee4d66d946a66
MD5 980cc22136b8bea23112de4a3aecbbc9
BLAKE2b-256 5038fbb8e65f9249bb9efad1a5c02cddb891dcc66b284d5657821671802bd987

See more details on using hashes here.

Supported by

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