Skip to main content

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 class.

🤝 Show your support - give a ⭐️ if you find this library useful

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. In your terminal type:

    pip install .
    

    or in editable mode

    pip install -e .
    

    You will also need requests to use btdx

    pip install requests
    

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)
    response = 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
    response.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.

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

    You can also pass optional parameters such as agregate.

     # Retrieve last 100 values between a date range and display data, if no range is provided last 100 values from current time will be obtained.
    
     start="YYYY-MM-DD"
     end="YYYY-MM-DD"
     response.get(stream_id=stream_id, start=start, end=end, 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

Metadata

Release files for btdx 0.0.3

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

Source distribution (sdist)

Source distribution for btdx 0.0.3
File Size Uploaded Provenance Actions
btdx-0.0.3.tar.gz 5.3 kB Without provenance Details for btdx-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for btdx 0.0.3
File Interpreter ABI Platform Actions
btdx-0.0.3-py3-none-any.whl Python 3 none any Details for btdx-0.0.3-py3-none-any.whl

Total release size: 11.3 kB

Release files / btdx-0.0.3.tar.gz

Download URL btdx-0.0.3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a7c1b5a7cfac185f38dcfb95377c16f2698dd0b5f627b3c84cacaf936615b54
BLAKE2b-256 checksum
How to use checksums
23170735e5cc45610055df41ce4c0e49067be7ac36d89fa51168da9703c3b954
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / btdx-0.0.3-py3-none-any.whl

Download URL btdx-0.0.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78a7c0eb59401a0f94be5950e6f9dd06c285e794e0d0308e5868489f8b6a792b
BLAKE2b-256 checksum
How to use checksums
48020b7c5a728b3216c42b38690ca9b55842f2e4678e556e0fabcf5f5592dfab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for btdx 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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