27 lines
905 B
Python
Executable File
27 lines
905 B
Python
Executable File
import httpx
|
|
import asyncio
|
|
|
|
async def get_full_vehicle_data(kenteken: str):
|
|
# A legfontosabb táblák listája
|
|
resources = {
|
|
"Alapadatok": "m9d7-ebf2",
|
|
"Üzemanyag": "826y-p86p",
|
|
"Műszaki": "8ys7-d773"
|
|
}
|
|
|
|
kenteken = kenteken.upper().replace("-", "")
|
|
|
|
async with httpx.AsyncClient() as client:
|
|
for name, res_id in resources.items():
|
|
url = f"https://opendata.rdw.nl/resource/{res_id}.json?kenteken={kenteken}"
|
|
resp = await client.get(url)
|
|
|
|
if resp.status_code == 200 and resp.json():
|
|
print(f"--- {name} ({res_id}) ---")
|
|
print(json.dumps(resp.json()[0], indent=2))
|
|
else:
|
|
print(f"--- {name} ({res_id}): Nincs adat vagy 404 ---")
|
|
|
|
if __name__ == "__main__":
|
|
import json
|
|
asyncio.run(get_full_vehicle_data("ZT646P")) # Teszt rendszám |