我正在尝试向api.weatherstack.com (请参阅documentation)发出GET请求。
这是我的react effect钩子:
useEffect(() => {
if (country === undefined) return
console.log(country.name)
axios
.get('http://api.weatherstack.com/current', {
params: {
access_key: api_key,
query: country.name
}
})
.then(response => {
console.log(response.data)
setWeather(response.data)
})
}, [api_key, country])
但是,每次运行此命令时,我都会收到以下错误:
{代码: 105,类型:"https_access_restricted",信息:“访问受限-您当前的订阅计划不支持HTTPS加密。”}
通过我的浏览器或通过Postman进行API调用工作得很好,所以我在想,我使用React或Axios的方式可能有问题。
此外,这个API调用大约有10%的时间有效,所以我很困惑为什么会发生这种情况。
发布于 2020-07-31 07:35:55
我想是因为你用的是免费套餐
https://stackoverflow.com/questions/63182663
复制相似问题