Skip to content

Commit

Permalink
1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Anghkooey committed Dec 4, 2023
1 parent bb6e4f6 commit 9c31e9a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
32 changes: 26 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# Changelog

## [1.3.3] (29-11-2023)
## [v1.3.4]() - 04.12.2023

* **Code format**
* **Updated README.md**
### **[client.py](https://github.com/user-sspmynxdvb/ua_alarm/blob/a75017703220ede06cfc6809f1b9c15c273abeea/ua_alarm/client.py)**:
* removed function get_region_alerts, removed function get_region_alerts, functionality has been moved to get_alerts.
* Links have been moved to constants
### Improved
- **functions: __init__, _make_request**
- **files: client.py**

### Added
- **libraries: from asyncio import run**

### More info
- **__init__: added run(self._make_request("GET", self._ALERTS_ENDPOINT))**
- **_make_request: `if response.status != 200: raise Exception("Invalid API token")`**


## [v1.3.3](https://github.com/user-sspmynxdvb/ua_alarm/tree/bb6e4f60d6362467e61cb3dd6b24b7d3beed668c) - 29.11.2023

### Improved
- **code: Code format**

### Added
- **variables: Links have been moved to constants**

### Removed
- **functions: get_region_alerts**

### More info
- **removed function get_region_alerts, functionality has been moved to get_alerts**
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ua-alarm"
version = "1.3.3"
version = "1.3.4"
description = "Implements api.ua_alarm.com API that returns info about Ukraine air raid alarms."
authors = ["user-sspmynxdvb <pewfellowmnemonic@gmail.com>"]
license = "GNUv3"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name="ua_alarm",
author="user-sspmynxdvb",
version="1.3.3",
version="1.3.4",
description="Implements api.ua_alarm.com API that returns info about Ukraine air raid alarms.",
license="GNUv3",
url="https://github.com/user-sspmynxdvb/ua_alarm",
Expand Down
11 changes: 10 additions & 1 deletion ua_alarm/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from asyncio import run
from typing import List, Optional, Union
from ua_alarm import types

from aiohttp import ClientSession

from ua_alarm import types


# from icecream import ic
class Client:
"""
A client to interact with the UkraineAlert API, providing methods to access various endpoints.
Expand Down Expand Up @@ -39,6 +43,8 @@ def __init__(self, api_token: str):
"""
self.base_url = "https://api.ukrainealarm.com"
self.headers = {"Authorization": api_token}
# test request
run(self._make_request("GET", self._ALERTS_ENDPOINT))

async def _make_request(
self,
Expand Down Expand Up @@ -70,6 +76,9 @@ async def _make_request(
async with session.request(
method, url, params=params, json=data
) as response:
if response.status != 200:
raise Exception("Invalid API token")

response_json = await response.json()

# Determine and return the appropriate model object based on the endpoint accessed
Expand Down

0 comments on commit 9c31e9a

Please sign in to comment.