Python API for cvr.dev
The official cvr.dev Python client library.
cvr.dev is a web service that maintains a live-updated cache of the Danish CVR registry.
We aim to provide a much simpler and more modern API compared to Virk/CVR's own Elastic Search solution. Our focus is on high availability and robustness, making it as easy and reliable as possible to retrieve data about Danish companies from the CVR database.
cvr currently requires python version 3.5 or above.
Make sure that you have pip installed, then run the following:
pip install cvr
Make sure that you have pip installed, then run the following in your project folder:
pip install .
The HTTP API is available at docs.cvr.dev.
In the examples/example.py dir there's a simple example program that verifies that your API key works and fetches different data from the server.
#!/usr/bin/env python import cvr client = cvr.Client(api_key='your api key') client.test_api_key() for virksomhed in client.cvr.virksomheder(cvr_numre=): print('Found virksomhed', virksomhed.cvr_nummer) for penhed in client.cvr.produktionsenheder(p_numre=): print('Found penhed', penhed.p_nummer)
This project has two types of tests: live tests and local tests. The live tests are run against our live servers and require that you set a valid API key in the environment variable CVR_DEV_TEST_API_KEY. Note: the live tests will count towards your usage.
We use the
unittest module for testing. You should use the following to run
# Run simple tests $ python -m unittest # Also all tests $ CVR_DEV_TEST_API_KEY="your key" python -m unittest
We want you to have the best experience possible; if for some reason didn't find what you were looking for at cvr.dev, reach out to us at email@example.com.
If you just want to check out the market, these are potential alternatives: