v1.3.10 - 15.01.2024
- files: alert_type.py, client.py
- Added
AlertType.INFO: "ЗМІ повідомляють про вибухи",
andAlertType.INFO: "Media reports about explosions",
- client.py: removed: init test
run(self.__make_request("GET", self._ALERTS_ENDPOINT))
andfrom asyncio import run
v1.3.9 - 30.12.2023
- files: python-app.yml, test.py, .env.template
- Added tests
v1.3.8 - 29.12.2023
- files: client.py, alert_type.py
- functions: __make_request, refactor_alert_type, alert_loop
- functions: _make_request 👉 __make_request
- alert_type.py: added variables: ALERT_TYPE_UA, ALERT_TYPE_EN
- __make_request:
case 404: raise Exception("The requested resource could not be found")
- refactor_alert_type: added ua_lang, ua or english language;
if ua_lang: return ALERT_TYPE_UA.get(type, "Повітряна тривога") else: return ALERT_TYPE_EN.get(type, "Air alarm")
- alert_loop: added ua_lang, ua or english language;
alert_message = "Оголошено тривогу" if ua_lang else "Air raid siren"
,clear_message = "Відбій тривоги" if ua_lang else "Air siren all clear"
v1.3.7 - 28.12.2023
- files: client.py
- functions: _make_request, alert_loop
-
_make_request:
match endpoint: case self._ALERT_STATUS_ENDPOINT: return types.AlertModification(**response_json) case self._REGION_HISTORY_ENDPOINT: return types.RegionAlarmsHistory(**response_json) case self._REGIONS_ENDPOINT: return types.RegionsViewModel(**response_json) case self._WEBHOOK_ENDPOINT: return types.WebHook(**response_json) case endpoint if self._ALERTS_ENDPOINT in endpoint: return [types.AlertRegionModel(**item) for item in response_json]
-
alert_loop: variables: utc renamed to tzinfo
v1.3.6 - 27.12.2023
- files: client.py
- functions: alert_loop
- libraries: from datetime import datetime
- functions: refactor_alert_type
- alert_loop:
utc = datetime.now().tzinfo changed_str.astimezone(utc)
v1.3.5 - 27.12.2023
- files: poetry.lock, client.py
- functions: _make_request
- libraries: from asyncio import sleep as async_sleep, from aiohttp.client_exceptions import ClientConnectorError
- functions: alert_loop
- _make_request:
match response.status: case 200: pass case 401: raise PermissionError("Invalid API token") case 503: raise Exception("API is currently unavailable") case unknown_status: raise Exception(f"Request failed with status code {unknown_status}\n{await response.text()}")
v1.3.4 - 04.12.2023
- functions: init, _make_request
- files: client.py
- libraries: from asyncio import run
- init: added run(self._make_request("GET", self._ALERTS_ENDPOINT))
- _make_request:
if response.status != 200: raise Exception("Invalid API token")
v1.3.3 - 29.11.2023
- code: Code format
- variables: Links have been moved to constants
- functions: get_region_alerts
- removed function get_region_alerts, functionality has been moved to get_alerts