Handle location API being exhausted (#30798)

This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2020-01-16 17:31:12 +01:00
1 parent d9d5e06baf
commit e1205409f3
2 files changed
+17

No files matched your search

+4
View File
@@ -174,6 +174,10 @@ async def _get_ipapi(session: aiohttp.ClientSession) -> Optional[Dict[str, Any]]
except (aiohttp.ClientError, ValueError):
return None
# ipapi allows 30k free requests/month. Some users exhaust those.
if raw_info.get("latitude") == "Sign up to access":
return None
return {
"ip": raw_info.get("ip"),
"country_code": raw_info.get("country"),