问题描述
为此,我找到了免费的 API 源:https://rapidapi.com/visual-crossing-corporation-visual-crossing-corporation-default/api/visual-crossing-weather/
{"message":"Invalid API key. Go to https:\/\/docs.rapidapi.com\/docs\/keys for more info."}
输入中似乎没有任何 API 密钥...
url = "https://visual-crossing-weather.p.rapidapi.com/history"
querystring = {"startDateTime":"2019-01-01T00:00:00","aggregateHours":"24","location":"Washington,DC,USA","endDateTime":"2019-01-03T00:00:00","unitGroup":"us","dayStartTime":"8:00:00","contentType":"csv","dayEndTime":"17:00:00","shortColumnNames":"0"}
headers = {'x-rapidapi-host': 'visual-crossing-weather.p.rapidapi.com'}
response = requests.request("GET",url,headers=headers,params=querystring)
print(response.text)
我认为不需要密钥,因为它应该是公共资源。
我还遇到过:OpenWeatherMap,我收到了一个学生密钥,但是在他们的示例代码中,没有关于如何使用坐标以及在何处实现密钥的说明。它看起来与他们网站上的文档不同。
import requests
url = "https://community-open-weather-map.p.rapidapi.com/climate/month"
querystring = {"q":"San Francisco"}
headers = {'x-rapidapi-host': 'community-open-weather-map.p.rapidapi.com'}
response = requests.request("GET",params=querystring)
print(response.text)
来源:https://rapidapi.com/community/api/open-weather-map/
我的最终目标是将其应用于我自己的包含时间戳、纬度和经度值的数据,如下所示:
timestamp latitude longitude
0 2021-06-09 08:12:33.820 57.728905 11.949309
1 2021-06-09 08:15:36.370 57.728874 11.949407
2 2021-06-09 08:16:06.000 57.728916 11.949470
3 2021-06-09 08:16:52.190 57.728836 11.949342
4 2021-06-09 08:18:08.000 57.728848 11.949178
我怎样才能使这个公共 API 工作?或者,我可以使用哪个其他公共信息(以及如何请求)从我的时间戳(20202 年的历史天气数据)和位置(瑞典)中获取天气信息。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)