Skip to main content

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 :

  1. Create an account at https://data.rte-france.com/.

  2. Create an application for web server and start associating the API to this application.

  3. 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:

  • APIService and PrevisionType are enums so you can pass them directly as strings.
  • Timestamps passed to client methods must be timezone-aware (Pandas Timestamp with 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)

Source distribution for pyrte 0.1.2
File Size Uploaded
pyrte-0.1.2.tar.gz 6.7 kB Details

Built distribution (wheel)

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

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 log

Release 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 log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

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