For a school project i need to work with the information that a api is giving me. I choose for the RDW API(Dutch License plate info). What i now have is only acces to 1000 licenseplates but i want to be able to get all off them.
import urllib.request
import json
url = "https://opendata.rdw.nl/resource/m9d7-ebf2.json?"
json_data_request = urllib.request.urlopen(url)
json_data = json.loads(json_data_request.readall().decode("utf-8"))
print(len(json_data))
With this code i'm only able to acces 1000 licenceplates What i want to get to work is(kenteken=licenceplate):
def locu_search(kenteken):
api_key = "CYcaHHuuvFfG2apjnvns8Ob41"
url = "https://opendata.rdw.nl/resource/m9d7-ebf2.json?$$app_token=" + api_key
after_url = "kenteken=" + kenteken
final_url = url + after_url
json_data_request = urllib.request.urlopen(final_url)
json_data = json.loads(json_data_request.readall().decode("utf-8"))
#print all info with that licenceplate
kenteken = input("Licenceplate:")
locu_search(kenteken)
What this code should do is:
I searched but was not able to get this working any info i can work with?
There are a couple of things you'll need to change in your code:
&
) between url
and after_url
to separate those two parameters: final_url = url + "&" + after_url
$limit
and $offset
paging parameters: https://dev.socrata.com/docs/paging.html