mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Switch from using Google Maps API for elevation to Open Elevation API (#22306)
## Description: Switches elevation helper to use [Open Elevation](https://open-elevation.com/) instead of Google Maps API which now requires a API key. It's a drop in replacement for Google Maps too! **Related issue (if applicable):** fixes #19860 ## Checklist: - [x] The code change is tested and works locally. - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass** - [x] There is no commented out code in this PR.
This commit is contained in:
parent
58c23bc2d9
commit
773c567563
@ -9,7 +9,7 @@ from typing import Any, Optional, Tuple, Dict
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
ELEVATION_URL = 'http://maps.googleapis.com/maps/api/elevation/json'
|
ELEVATION_URL = 'https://api.open-elevation.com/api/v1/lookup'
|
||||||
IP_API = 'http://ip-api.com/json'
|
IP_API = 'http://ip-api.com/json'
|
||||||
IPAPI = 'https://ipapi.co/json/'
|
IPAPI = 'https://ipapi.co/json/'
|
||||||
|
|
||||||
@ -70,7 +70,6 @@ def elevation(latitude: float, longitude: float) -> int:
|
|||||||
ELEVATION_URL,
|
ELEVATION_URL,
|
||||||
params={
|
params={
|
||||||
'locations': '{},{}'.format(latitude, longitude),
|
'locations': '{},{}'.format(latitude, longitude),
|
||||||
'sensor': 'false',
|
|
||||||
},
|
},
|
||||||
timeout=10)
|
timeout=10)
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user