
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Django INPI allows you to use the INPI API to to get information about companies.
django_inpi.fields.SIRETField
, django_inpi.fields.SIRENField
) which ensure that submitted Siren/Siret are numbers, and that their lenght is respectively 14 & 9 chars.django_inpi.forms.SIRETForm
, django_inpi.forms.SIRENForm
)django_inpi.api.INPIApi
) which allows you to get a token and make your own requests to the INSE API. Available functions:
login()
: send a login POST request to INPI API, stores the Bearer token in your api instance (automatically called in INPIApi.__init__()
, call INPIApi(skip_init=True)
to skip login (if so, you will not have a token, and will need to login yourself)).get(siret=None, siren=None)
: get company details using it's siret/siren. Returns the whole json from INPI API.get_generic_company_data(siret=None, siren=None)
: get company details using it's siret/siren. Returns a formatted json containing only a few values (see examples below).django_inpi.views.SIRETFormGetAllJsonMixin
: Uses SIRETForm
, and calls INPIApi.get(siret)
.django_inpi.views.SIRETFormGetGenericCompanyDataMixin
Uses SIRETForm
, and calls INPIApi.get_generic_company_data(siret)
.django_inpi.views.SIRENFormGetAllJsonMixin
: Uses SIRENForm
, and calls INPIApi.get(siren)
.django_inpi.views.SIRENFormGetGenericCompanyDataMixin
Uses SIRENForm
, and calls INPIApi.get_generic_company_data(siren)
.python3 -m pip install django-inpi
INSTALLED_APPS
:
"django_inpi",
DJANGO_INPI_USERNAME = "username"
DJANGO_INPI_PASSWORD = "username"
from os import getenv
DJANGO_INPI_USERNAME = getenv("DJANGO_INPI_USERNAME", None)
DJANGO_INPI_PASSWORD = getenv("DJANGO_INPI_PASSWORD", None)
# my_app/urls.py
urlpatterns = [
# ...
path(
"get-company-infos-from-siret/",
views.GetCompanyInfosView.as_view(),
name="get_company_infos",
),
]
# my_app/views.py
from django_inpi.views import SIRENFormGetAllJsonMixin
# ...
class GetCompanyInfosView(
SIRENFormGetAllJsonMixin, # <-- our mixin here
FormView, # required, our mixin does not inherit from any *View
):
def get_success_url(self):
return reverse(
"my_app:get_company_infos",
)
This package comes with an API that you can use independently from the Field or Form. Here's how to use it:
from django_inpi.api import INPIApi
inpi_api = INPIApi()
# use `inpi_api = INPIApi(skip_init=True)` if you want to call the login function yourself
# Get full json
siret = "01234567891234"
company_infos = inpi_api.get(siret=siret)
# OR
siren = "123456789"
company_infos = inpi_api.get(siren=siren)
from django_inpi.api import INPIApi
inpi_api = INPIApi()
# Get partial json
siret = "01234567891234"
generic_company_infos = inpi_api.get_generic_company_data(siret=siret)
# OR
siren = "123456789"
generic_company_infos = inpi_api.get_generic_company_data(siren=siren)
generic_company_infos
wil contains those data:
{
"siren": 123456789,
"data": {
"name": "NAME",
"legal_status": {
"full_name": "Full legal status name",
"acronym": "FLSN"
},
"address": {
"street_number": "1",
"street_type": "STREET TYPE",
"street_name": "STREET NAME",
"postal_code": "01234",
"city": "CITY NAME",
"full_address": "1 STREET TYPE STREET NAME 01234 CITY NAME"
},
"manager": {
"first_name": "MANAGER FIRST NAME",
"last_name": "MANAGER LAST NAME"
},
}
}
DJANGO_INPI_USERNAME
(no default, required): You must set this value in your settings in order to be able to access the INPI API.DJANGO_INPI_PASSWORD
(no default, required): You must set this value in your settings in order to be able to access the INPI API.You must have an account on the INPI website in order to set your credentials, see here for registering a new account or here to login.
DJANGO_INPI_LOGIN_URL
(default https://registre-national-entreprises.inpi.fr/api/sso/login
): Set this var in your settings if you want to use a custom (selfhosted?) api.FAQs
Get companies info by using INPI api.
We found that django-inpi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.