A client for Energize Andover's Building Energy Gateway, with a focus on clarity and usability.
Project description
Data Reading Requests
A new client for Energize Andover's Building Energy Gateway, with a focus on clarity and usability.
Features
- It's packaged, so you can install it with pip!
- It's fully unit-tested.
- It's open source, and contributions are welcome.
API Changes from building_data_requests
For compatibility, datareadingrequests' function definitions are similar to those of building_data_requests. However, there are a few key differences between the two modules:
- Instead of a tuple, datareadingrequests'
get_value()
returns a DataReading namedtuple. This allows you to use the original tuple notation or the cleaner dot notation. Read more about namedtuples here. - datareadingrequests has a predictable, single return type for
get_value()
. With building_data_requests,get_value()
could return a valid result orNone
. Here, it can only return a valid result; it raises an exception if the server returns no data. The reasoning for this is well-explained by williballenthin:
I've learned that returning more than one type of data from a function is a recipe for trouble. For example, when a function can return a string or a list, then every place that the function is called must check "is it a string or a list?". If the programmer forgets this, then inevitably, the program breaks at an inconvenient time. By extension, if a function returns a string or
None
, then every invocation must check "is the resultNone
?". This is easy to forget, and leads to latent bugs. With the existing style, forgetting atry/except
block is also a bug, but when the exception is generated, the programmer gets a very explicit stack trace with easy-to-find line number.
- In the same way, datareadingrequests'
get_bulk()
raises an exception if the server returns no data for any specific instance. - datareadingrequests has no way (currently) to change hostname or port.
- datareadingrequests does not retry requests without SSL.
Setup
Use your favorite Python package manager, and do as you would with pandas, matplotlib, etc.
pip:
pip install datareadingrequests
pip freeze > requirements.txt
Poetry:
poetry add datareadingrequests
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
Built Distribution
File details
Details for the file datareadingrequests-2.0.1.tar.gz
.
File metadata
- Download URL: datareadingrequests-2.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.11 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37cb6145acc0b5058ecded8cde57a411087150591ff66e2670815a3c7d17e8e3 |
|
MD5 | b0fb57b7803b68e72da0515658f6abd5 |
|
BLAKE2b-256 | db5ec54fac25c2259b5a22b7abb36e02fbd04dfa794dda4f1dd9ef6dbd3e34f1 |
File details
Details for the file datareadingrequests-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: datareadingrequests-2.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.11 Darwin/20.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a321c42cddaaf281b8e4939e2604a57bf29620711adcad65fcf6589e69f81f |
|
MD5 | 50887bdd63174cd2918626c571a21d23 |
|
BLAKE2b-256 | e7528a090571db7adc2d398899d82a48ee880901fdfa7430923ce3a4ea9e0475 |