Skip to main content

Async Python client for the feuxdeforet.fr unofficial API

Project description

pyfeuxdeforet-fr

CI PyPI

pyfeuxdeforet-fr is an unofficial async Python client for JSON data exposed by feuxdeforet.fr.

The package is intentionally small and close to the site payloads. It is meant to provide reusable transport and typed convenience models for future projects, including a possible Home Assistant / HACS integration, without baking Home Assistant entity decisions into the library.

Features

  • Async API client built for aiohttp.
  • Fetch French regions and departments from /api/regions.
  • Fetch national counters and vigilance/risk totals from /api/stats.
  • Fetch homepage news summaries from /api/home.
  • Fetch raw cartography GeoJSON from /fdf/cartographie/geojson.
  • Bootstraps the cartography proxy from /cartes/feux/, including its dynamic nonce and cookies.
  • Raw payload helpers are available for integrations that need fields not yet modeled.
  • Typed package (py.typed) for downstream users.

Installation

pip install pyfeuxdeforet-fr

Quick start

import asyncio

from aiohttp import ClientSession
from pyfeuxdeforet_fr import FeuxDeForetClient


async def main() -> None:
    async with ClientSession() as session:
        client = FeuxDeForetClient(session=session)

        regions = await client.get_regions()
        stats = await client.get_stats()
        home = await client.get_home()
        geojson = await client.get_geojson(
            last_update="2026-07-05T00:11:12+02:00",
        )

        print(f"Regions: {len(regions or [])}")
        print(f"Stats: {stats}")
        print(f"Latest article: {home.articles[0].title if home and home.articles else None}")
        print(f"GeoJSON type: {geojson.get('type') if geojson else None}")


asyncio.run(main())

API overview

FeuxDeForetClient(session, base_url="https://feuxdeforet.fr")

Create a client using an injected aiohttp.ClientSession.

The caller owns the session lifecycle. This keeps the library suitable for applications that already manage connection pooling, such as Home Assistant.

get_regions() / get_regions_payload()

Return normalized Region objects, or the raw /api/regions payload.

Each Region contains Department entries from the source depts field.

get_stats() / get_stats_payload()

Return normalized Stats, or the raw /api/stats payload.

Known fields include published fire counts over several periods and aggregated risk-zone counters.

get_home() / get_home_payload()

Return normalized homepage article summaries, or the raw /api/home payload.

The raw payload is also kept on HomeData.raw because the homepage response may grow with sections that are not yet modeled.

get_geojson(scope="web", last_update=None, nonce=None, headers=None)

Return the raw cartography GeoJSON payload.

By default, each call first loads /cartes/feux/, extracts window.fdfBridge.proxyNonce, retains any response cookies, then reproduces the frontend proxy request with:

X-FDF-Nonce: <dynamic proxyNonce>
Referer: https://feuxdeforet.fr/cartes/feux/

last_update accepts either a datetime or an already formatted string. A manual nonce and extra headers remain available for diagnostics. The legacy nonce="0" value now enables automatic discovery instead of sending zero.

Known limitations

  • This is an unofficial client and is not affiliated with feuxdeforet.fr.
  • The API is not publicly documented and may change without notice.
  • The HTML bootstrap format is private frontend behavior and may change without notice.
  • Most endpoints are intentionally exposed through raw helpers as well as typed models.

Development

For contributors:

python -m pip install -r requirements_dev.txt
pytest -q --cov
mypy pyfeuxdeforet_fr
python -m build

Demo script

Run the full feature demo with:

python examples/demo.py

It exercises raw payload helpers, normalized models, and the GeoJSON endpoint. The GeoJSON call accepts overrides while reverse engineering continues:

python examples/demo.py --last-update "2026-07-05T00:11:12+02:00"

License

Apache-2.0

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

pyfeuxdeforet_fr-0.2.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyfeuxdeforet_fr-0.2.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pyfeuxdeforet_fr-0.2.0.tar.gz.

File metadata

  • Download URL: pyfeuxdeforet_fr-0.2.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyfeuxdeforet_fr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 caa16cf917ec7f1eb3a095d89cd4d374684413e44eaf14be7927a448933e3a06
MD5 fd4097229dd484d3a4d9338b39204ec8
BLAKE2b-256 f5ab616bc7b329caf5d4d4941045764a06e81986b46f70ad5cbdbd87e4d4f8ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfeuxdeforet_fr-0.2.0.tar.gz:

Publisher: publish.yml on jul-fls/pyfeuxdeforet-fr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyfeuxdeforet_fr-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyfeuxdeforet_fr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c05cd7b33ac25cd3881c299f26a035daf5502464c48604438d61e239db4f7fe
MD5 af81fe382e37313b69264045fdfaf699
BLAKE2b-256 487fb6554fce842c6a5c608c54ac5c00a24e076682bffa06c45f919dbc5a7a5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyfeuxdeforet_fr-0.2.0-py3-none-any.whl:

Publisher: publish.yml on jul-fls/pyfeuxdeforet-fr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page