pyrte
pyrte is a lightweight Python client library for interacting with RTE (Réseau de Transport d'Électricité) public APIs (https://data.rte-france.com). It provides a high-level interface for authentication and data retrieval from RTE endpoints, including automatic handling of per-endpoint OAuth2 tokens.
Key features:
- High-level client for RTE APIs
- Per-endpoint OAuth2 token management
- Utilities to fetch time series data (e.g., short-term consumption)
Installation
Install from PyPI:
pip install pyrte
Testing
Simply run at the root:
pytest
You don't need credentials to run tests
Credentials
For each API you want to request :
-
Create an account at https://data.rte-france.com/.
-
Create an application for web server and start associating the API to this application.
-
In the application tab, one will find the client id and the related client secret code needed for requesting data.
Quick Usage Example
The following example demonstrates how to create an RTEClient and fetch short-term consumption data. Replace the credential placeholders with your real client IDs and secrets.
import pandas as pd
from pyrte.rte_client import RTEClient, APIService, PrevisionType
creds = {
APIService.short_term_consumption: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
},
APIService.wholesale_market: {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
},
}
client = RTEClient(creds)
# Use timezone-aware timestamps (example: CET / +01:00)
start = pd.Timestamp("2025-01-01T00:00:00+01:00")
end = pd.Timestamp("2025-01-02T00:00:00+01:00")
series = client.get_short_term_consumption(start, end, PrevisionType.REALISED)
print(series.head())
Notes:
APIServiceandPrevisionTypeare enums so you can pass them directly as strings.- Timestamps passed to client methods must be timezone-aware (Pandas
Timestampwith tz info). - The library will automatically refresh OAuth2 tokens per service when required.
Contributing
Contributions and bug reports are welcome:
I only implemented one endpoint as an exemple and because it was the one i needed, so feel free to open issues or pull requests to add new functionality !
License
See the LICENSE file for license terms.
Metadata
Release files for pyrte 0.1.2
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 |
|---|---|---|---|---|
| pyrte-0.1.2.tar.gz | 6.7 kB | With provenance | Details for pyrte-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrte-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for pyrte-0.1.2-py3-none-any.whl |
Total release size: 14.0 kB
Release files / pyrte-0.1.2.tar.gz
| Download URL | pyrte-0.1.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e7e88e94dcc5603b0d2b4f288df8d2e684fe629d9c3e0f4376e2f154d7de684
|
|
BLAKE2b-256 checksum How to use checksums |
9fd3ca4fb112542344bc64b52d557e8accd5f0200af07825eb3f71a219acf692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2025.
Transparency logRelease files / pyrte-0.1.2-py3-none-any.whl
| Download URL | pyrte-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46437087f4d2dd1a97cb9306678e884dcb41fa7cac42c23e534aded5b6c485f3
|
|
BLAKE2b-256 checksum How to use checksums |
70e20a120c332996e43f2bc75ceb58d5512e00ab0f9bb1cc40ac886f9ce857d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2025.
Transparency logSecurity for pyrte 0.1.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyrte-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2025.
Transparency logA 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.