Here api Here.com API正确的结构

Here api Here.com API正确的结构,here-api,Here Api,当我运行此代码时: url = f"https://traffic.ls.hereapi.com//traffic/6.3/incidents.json?proximity=37.3541,-121.9552?apiKey={api_key}" Scrape Here.com for any traffic incidents in the last 24 hours for the set proximity res = requests.get(url) date_requested =

当我运行此代码时:

url = f"https://traffic.ls.hereapi.com//traffic/6.3/incidents.json?proximity=37.3541,-121.9552?apiKey={api_key}"

Scrape Here.com for any traffic incidents in the last 24 hours for the set proximity
res = requests.get(url)
date_requested = time.strftime('%Y-%m-%d')
time_requested = time.strftime('%H:%M')
date_requested; time_requested #print date & time of request
我得到这个错误:

<html><body><p>{"error":"Unauthorized","error_description":"ApiKey is missing."}</p></body></html>
{“错误”:“未经授权”,“错误描述”:“缺少ApiKey.”

谁能告诉我为什么?我知道API键是有效的,因为我生成了一个新的API键,并将其剪切粘贴到上面的代码中,所以它必须是我查询的结构,不是吗


我非常感谢您的帮助。

问题出在您的URL部分替换第二个?使用&如下所示-

url = f"https://traffic.ls.hereapi.com//traffic/6.3/incidents.json?proximity=37.3541,-121.9552&apiKey={}"

要拆分请求中的各种参数,我们使用&operator。URL中只能使用一个“?”符号。后面的所有内容都是参数,它们应该用符号“&”连接起来。要了解有关构造正确URL的更多信息,请参阅此wikipedia文章: