Registry / http-networking / api-insee

api-insee

JSON →
library1.6pypypiunverified

Python helper to query the Sirene API on api.insee.fr. Current version is 1.6, providing access to the Sirene database (companies and establishments) and links of succession. Release cadence is irregular, with recent updates in 2023.

http-networkingdata
pip install api-insee
Install & Compatibility
Where this runs
tested against v1.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.9s
py 3.11
✓ —
✓ 2.6s
py 3.12
✕ build_error
✕ build_error
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 3.1s
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ApiInsee
from api_insee import ApiInsee
Correct import after pip install
ApiInsee
import api_insee
api_insee is the module name, not the class; you must import the class explicitly

Initialize the API with credentials and perform a basic unit search.

from api_insee import ApiInsee api = ApiInsee( key=os.environ.get('INSEE_KEY', 'mon_cle'), secret=os.environ.get('INSEE_SECRET', 'mon_secret') ) # Request a unit (entreprise) by SIREN response = api.sirene.units(criteria={'q': 'siren:398607333'}) print(response.text)
Debug
Known issues
gotchaThe environment variables for credentials are named differently in some examples (INSEE_KEY/INSEE_SECRET vs API_INSEE_KEY/API_INSEE_SECRET). Always use the exact attribute names when passing to the constructor.
fix
Use key and secret parameters as shown in the quickstart or set environment variables accordingly.
affects: all
gotchaThe API responses are raw requests.Response objects, not parsed JSON automatically. You must call .json() or .text yourself.
fix
Call response.json() after each request to get a Python dict.
affects: <=1.6
gotchaThe query parameter 'q' uses the Sirene API's internal syntax (colon-separated field:value). New users often pass plain strings without the proper field prefix.
fix
Use the Criteria.Field helper or write queries like 'siren:398607333'.
affects: all
Upgrade
Version history
1.6latest on PyPI
Audit
Dependencies
requestsrequiredHTTP library for API calls
Agent activity
24 hits · last 30 days
node
6
ahrefsbot
3
Amazon
1
amazonbot
1
Resources