对于一个学校项目,我需要使用 api 给我的信息。我选择 RDW API(荷兰车牌信息)。我现在拥有的只是访问 1000 个车牌,但我希望能够从它们身上全部拿走。
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))
使用此代码,我只能访问 1000 个牌照我想要开始工作的是(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)
这段代码应该做的是:
- 索要牌照。
- 使用您输入的值转到函数。
- 打印该牌照的所有信息。(还没有,因为我无法让前面的行不起作用)
我进行了搜索,但无法使用任何我可以使用的信息?