Pyfingridapi
pyfingridapi is a Python client library for interacting with the Fingrid API. It provides convenient methods for accessing time-series data, dataset information, notifications, and the health status of the Fingrid API.
Features
- Fetch real-time and historical time-series data.
- Retrieve detailed dataset metadata.
- Access active notifications and alerts.
- Check the health status of the Fingrid API services.
- Built using
httpxfor robust HTTP interactions andpydanticfor data validation.
Installation
Install the library using pip:
pip install pyfingriaApi
Usage
Initialization
Create an instance of the FingridApi client:
import httpx
from pyfingridapi import FingridApi
# Initialize the API client
with httpx.Client() as client
api_client = FingridApi(client=client, x_api_key="your_api_key")
Fetching the Latest Data by Dataset
latest_data = api_client.get_last_data_by_dataset(datasetId=12345)
print(latest_data)
Fetching Multiple Time Series Data
time_series_data = api_client.get_multiple_timeseries_data(
datasetId=[123, 456],
startTime="2024-01-01T00:00:00Z",
endTime="2024-01-31T23:59:59Z"
)
print(time_series_data)
Retrieving Dataset Information
dataset_info = api_client.get_dataset(datasetId=12345)
print(dataset_info)
Fetching Active Notifications
notifications = api_client.get_active_notifications()
print(notifications)
Checking API Health Status
health_status = api_client.get_health_status()
print(health_status)
Models
The library uses pydantic models to structure and validate the data retrieved from the API. Key models include:
DataRecord: Represents a single data point in a time series.TimeSeriesDataResponse: Encapsulates time-series data and pagination information.DataSet: Contains detailed metadata about a dataset.ActiveNotifications: Represents active notifications from Fingrid.HealthStatus: Describes the health status of the Fingrid API.
Logging
pyfingridapi uses Python's logging module to log errors and debug information. To configure logging:
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("fingridapi")
TODO
- Add support for API endpoints such as
GetDatasetFile,GetDatasetFileData, andGetDatasetShorts. - test this as module
- push this to pypi_test
- push this to pypi
- create documentation site
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Feel free to submit issues or pull requests to enhance the library.
Metadata
Release files for pyfingridapi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfingridapi-0.1.1.tar.gz | 6.4 kB | Without provenance | Details for pyfingridapi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfingridapi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyfingridapi-0.1.1-py3-none-any.whl |
Total release size: 12.9 kB
Release files / pyfingridapi-0.1.1.tar.gz
| Download URL | pyfingridapi-0.1.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e47dad1d7ed9d0822290d1a561d4a347cfadc0f73cdbe5bb146e77b65b991805
|
|
BLAKE2b-256 checksum How to use checksums |
7f7c90d720374831a8ab9eee0ebafcda0b98c4bd9c7d0d27ebfabf17bc5cb8dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Release files / pyfingridapi-0.1.1-py3-none-any.whl
| Download URL | pyfingridapi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b86a38a1ab05d4f21e428272d3c9e4ff657a8be37e4261525099c1e1ab01fae2
|
|
BLAKE2b-256 checksum How to use checksums |
43fa9729ec991adb96eb79c161daa9a1ba7e4b474fdc77a79bb1ee7cdb3be03f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Security for pyfingridapi 0.1.1
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.