我使用位置v2 API来使用Accesspoints的mac定位一些资产。它工作得很好,但有时mac地址并不是它应该找到的位置。因此,当我试图定位具有5-6个mac地址的位置(1个mac地址的位置不正确)时,API会给出这样的消息:
'title':'Not‘,'status':404,'code':’E 606404‘,'action':’在请求中提供的值不能为响应生成任何内容。请求中的无线局域网和单元格的位置未知,或者无线电测量的位置非常分散,无法确定位置。确保网络测量是正确和一致的。尝试允许
area或any用于蜂窝定位,而singleWifi用于无线局域网定位。‘原因’:‘位置未找到’。
我怎么能绕过这种错误呢?
以下是代码:
data = {
"wlan": []
}
#for wifi in networks:
entry = {
"mac": "xx:xx:xx:xx:xx:xx",
"rss": -42
}
data["wlan"].append(entry)
entry1 = {
"mac": "yy:yy:yy:yy:yy:yy",
"rss": -54
}
data["wlan"].append(entry1)
entry2 = {
"mac": "zz:zz:zz:zz:zz:zz",
"rss": -76
}
data["wlan"].append(entry2)
#This mac address is not well located (400 kms difference from the real position)
#entry3 = {
# "mac": "vv:vv:vv:vv:vv:vv",
# "rss": -64
#}
#data["wlan"].append(entry3)
import json
import requests
headers = {"Content-Type": "application/json"}
url = "https://positioning.hereapi.com/v2/locate?apiKey=" + "my_api_key" + "&desired=altitude" + "&fallback=singleWifi"
print(data)
response = requests.post(url, headers=headers, data=json.dumps(data))发布于 2021-05-19 09:28:13
请您试一下下面的示例代码。要获得最佳结果,请遵循文档链接中定义的提示: document:https://developer.here.com/documentation/positioning-api/dev_guide/topics/tips-for-data-accuracy.html
import requests
import json
url = "https://positioning.hereapi.com/v2/locate?apiKey={your_api_key}&desired=altitude&fallback=singleWifi"
payload = json.dumps({
"wlan": [
{
"mac": "xxxxxx"
},
{
"mac": "xxxxxx"
}
]
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)https://stackoverflow.com/questions/67436175
复制相似问题