{"id":23272,"library":"api-insee","title":"api-insee","description":"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.","status":"active","version":"1.6","language":"python","source_language":"en","source_url":"https://github.com/sne3ks/api_insee","tags":["insee","sirene","french-company-data","api-client"],"install":[{"cmd":"pip install api-insee","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"HTTP library for API calls","package":"requests","optional":false}],"imports":[{"note":"Correct import after pip install","symbol":"ApiInsee","correct":"from api_insee import ApiInsee"},{"note":"api_insee is the module name, not the class; you must import the class explicitly","wrong":"import api_insee","symbol":"ApiInsee"}],"quickstart":{"code":"from api_insee import ApiInsee\n\napi = ApiInsee(\n    key=os.environ.get('INSEE_KEY', 'mon_cle'),\n    secret=os.environ.get('INSEE_SECRET', 'mon_secret')\n)\n\n# Request a unit (entreprise) by SIREN\nresponse = api.sirene.units(criteria={'q': 'siren:398607333'})\nprint(response.text)","lang":"python","description":"Initialize the API with credentials and perform a basic unit search."},"warnings":[{"fix":"Use key and secret parameters as shown in the quickstart or set environment variables accordingly.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Call response.json() after each request to get a Python dict.","message":"The API responses are raw requests.Response objects, not parsed JSON automatically. You must call .json() or .text yourself.","severity":"gotcha","affected_versions":"<=1.6"},{"fix":"Use the Criteria.Field helper or write queries like 'siren:398607333'.","message":"The 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install api-insee' and ensure you are using the correct import: 'from api_insee import ApiInsee'.","cause":"Package not installed or installed under a different name.","error":"ImportError: No module named 'api_insee'"},{"fix":"Provide both key and secret: `api = ApiInsee(key='...', secret='...')`.","cause":"Credentials not provided when creating ApiInsee instance.","error":"TypeError: __init__() missing 2 required positional arguments: 'key' and 'secret'"},{"fix":"Verify your INSEE API key and secret. Ensure they are correct and have access to the Sirene API.","cause":"Invalid or missing API credentials.","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}