Google Weather API returns HTTP 403 Error

2020-05-09 09:38发布

I use the Google weather API in my web site, and today I get an error that the API link doesn't return any data.

When I check the link directly I get an (Error 403).

Here is the link.

Can anyone please tell me a solution for this and provide me another link for the API?

2条回答
孤傲高冷的网名
2楼-- · 2020-05-09 09:42

Every now and then the API stops working for short periods of time, the last days more often a 403 is trown. For my site, last night it happened 13 times. But the site tries immediately again and the second or third time, the data loads without problems. As the API is unofficial, not sure what’s causing the 403.

Make sure you cache the data as the API will block your IP temporary when you make too much requests. In my case, I cache for 20 minutes and if no data can retrieved, the site will not try more than 10 times to reload the API. Once I forgot to turn caching on after debugging and as my site did many hundred requests (with every visitor), the IP was blocked within an hour. If a remember correct, the error was not a 403. Fortunately, the block lasts for less than a half day.

查看更多
劫难
3楼-- · 2020-05-09 09:46

There is currently an intermittent 403 Forbidden response to the Google Weather API that you are using. See Google Weather API 403 Error

The reason for the intermittent 403 response is not known but has been a problem since the 7th of August 2012.

查看更多
登录 后发表回答