Skip to main content

dgfip-fetcher

dgfip-fetcher is a CLI tool to automatically download all your tax documents (income tax notices, declarations, property taxes, etc.) from your personal space on impots.gouv.fr.

Note: This tool is specifically designed for the French tax administration website.

Key Features

  • Time-saving: No more manual clicking through each year.
  • Clear Organization: One folder per year, with the income tax notices (avis d'impôt) at its root and the other documents in sub-folders (Déclarations, Taxes locales, Factures, Autres). Files are named after the year and the document title (e.g., 2022_avis_de_taxes_foncieres_2022_c4e1a9.pdf). The short suffix is derived from the document identifier, so two documents with the same title (e.g. local invoices) never collide.
  • Incremental: Documents already present in the output folder are skipped, so you can run it every year in the same folder.
  • Secure: Your credentials are stored in your system's secure vault (Keyring).
  • Simple: One command to fetch everything.

Installation

pip install dgfip-fetcher

After installation, you must download the browser used by Playwright:

python -m playwright install chromium

(Note: If you use uv, run: uv run playwright install chromium)

Usage

Once installed, simply run:

dgfip-fetcher

Options

  • --years N: Number of previous years to scan (default: 10).
  • --output DIR: Destination folder for PDFs.
  • --flat: Saves all files directly in the destination folder instead of year folders.
  • --debug: Shows the browser during login (useful for troubleshooting). When asked for the 2FA code, you can also type it in the browser and just press Enter in the terminal.
  • --reset: Clears saved credentials and session.

Example:

dgfip-fetcher --years 5 --output my_tax_archives

How It Works

  1. Authentication: Uses Playwright to handle login and 2FA (SMS/Email) from the official French tax portal. The session is saved and reused, so the 2FA code is only asked when it has expired. If the login fails, a screenshot of the page is saved in the config folder (login_failure.png) to help troubleshooting.
  2. Secret Storage:
    • Your French tax ID (SPI) and the session cookies are stored in a standard config folder, readable only by your user.
    • Your password is encrypted and stored in your OS keychain.
  3. Retrieval: All documents (tax notices, returns, acknowledgements, local invoices...) are listed from the "Documents" page and downloaded with plain HTTP requests.

Development

To contribute:

  1. Clone the repository.
  2. Install dependencies: uv sync.
  3. Run in dev mode: uv run dgfip-fetcher.

Disclaimer

This project is an independent tool and is NOT affiliated with the Direction générale des Finances publiques (DGFiP) or impots.gouv.fr. Use it at your own risk.

Metadata

Release files for dgfip-fetcher 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dgfip-fetcher 0.2.0
File Size Uploaded Provenance
dgfip_fetcher-0.2.0.tar.gz 42.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dgfip-fetcher 0.2.0
File Interpreter ABI Platform
dgfip_fetcher-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.4 kB

Release files / dgfip_fetcher-0.2.0.tar.gz

Download URL dgfip_fetcher-0.2.0.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
680aa008037695f50c231e170435943eba10dc6f5c6dfc060dfcbead2ebe5ba5
BLAKE2b-256 checksum
How to use checksums
efdb90fc40052304535bd68c93dbfa81bea439b972082f2212872da3d14529b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dgfip_fetcher-0.2.0-py3-none-any.whl

Download URL dgfip_fetcher-0.2.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5abd97ad04ca0219e599e458881b9dcdc8dddaf2bf3524c0befd3a7f22b6afb5
BLAKE2b-256 checksum
How to use checksums
a5ca3fe25d6d8a8304fd7766cabdc6f2b431151e4a4c51ad617134fcaced522d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dgfip-fetcher 0.2.0

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.

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