(self, credentials: BundleCredentials)
| 6 | class OpenWeather(BundleHandler): |
| 7 | |
| 8 | async def verify(self, credentials: BundleCredentials): |
| 9 | # todo: implement with actual verification logic |
| 10 | lat: float = 30.25 |
| 11 | lon: float = 120.166 |
| 12 | |
| 13 | base_url = "https://api.openweathermap.org/data/3.0/onecall" |
| 14 | params = { |
| 15 | 'lat': lat, |
| 16 | 'lon': lon, |
| 17 | 'exclude': 'minutely,hourly,daily,alerts', |
| 18 | 'appid': credentials.credentials.get("OPEN_WEATHER_API_KEY", ""), |
| 19 | 'units': 'metric' |
| 20 | } |
| 21 | async with ClientSession() as session: |
| 22 | async with session.get(base_url, params=params) as response: |
| 23 | if response.status == 200: |
| 24 | pass |
| 25 | else: |
| 26 | raise_credentials_validation_error() |
| 27 | |
| 28 | |
| 29 |
nothing calls this directly
no test coverage detected