Pull data directly from the danish vehicle registar with dmr.py
Project description
dmr.py
You will no longer need an exspensive API for danish license plate lookups with dmr.py, this tool scrapes the danish vehicle registar directly and returns the data for you to use in your application. Be aware, that because of skat.dk's very slow database lookups, it could take about 3-4 seconds before getting a response.
Installation:
Install with pip
python -m pip install dmr.py
Install current code from this repo, you will need to have git installed in order to do this.
python -m pip install git+https://github.com/j4asper/dmr.py
Example
Synchronously
from dmr import DMR
license_plate = "cw87553"
# Get DMR object with data
vehicle = DMR().get_by_plate(license_plate)
print("The vehicle make is:", vehicle.make)
Asynchronously
from dmr import DMR
license_plate = "cw87553"
# Get DMR object with data
vehicle = await DMR().get_by_plate_async(license_plate)
print("The vehicle make is:", vehicle.make)
All attributes to the DMR() object can be viewed in the Wiki
Contributing:
I would be more than happy if those who know how to make pull requests, contribute with code!
ToDo
- Add from_dict and to_dict functions.
- Add documentation with all possible values.
- Scrape more parts of the DMR site to get even more data.
- Add more broad tests with different types of cars or bikes.
Issue we can't do anything about.
If you have used this tool, you might notice that it is slow AF. That is probably due to our government using multiple 80-100 GB XML files as the databse for all vehicles in Denmark. It roughly takes about 3 seconds to do a lookup on the DMR site. Caching is highly recommended!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.