Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
A.Shpak committed Mar 12, 2024
1 parent 8e89f03 commit 177debb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chatushka/_transport.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from types import TracebackType
from typing import Any, Literal

from httpx import AsyncClient, Response
from httpx import AsyncClient, RequestError, Response

from chatushka._constants import HTTP_REGULAR_TIMEOUT
from chatushka._errors import ChatushkaResponseError
Expand Down Expand Up @@ -85,13 +85,14 @@ async def get_updates(
params = {} if not offset else {"offset": offset}
if self._timeout:
params["timeout"] = self._timeout
results = [
Update.model_validate(entry)
for entry in await self._api_request(
try:
response = self._api_request(
api_method="getUpdates",
**params,
)
]
except RequestError:
return [], offset
results = [Update.model_validate(entry) for entry in await response]
if results:
offset = results[-1].update_id + 1
return results, offset
Expand Down

0 comments on commit 177debb

Please sign in to comment.