Skip to content

Commit

Permalink
Fix import and update async timeout (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasnicolaas authored Dec 5, 2023
1 parent a2d00a1 commit ca8ee66
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/hamburg/hamburg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import TYPE_CHECKING, Any, cast
from typing import Any, Self, cast

import async_timeout
from aiohttp import ClientError, ClientSession
from aiohttp.hdrs import METH_GET
from yarl import URL

from .exceptions import UDPHamburgConnectionError, UDPHamburgError
from .models import DisabledParking, Garage, ParkAndRide

if TYPE_CHECKING:
from typing_extensions import Self


@dataclass
class UDPHamburg:
"""Main class for handling data fetchting from Urban Data Platform of Hamburg."""
"""Main class for handling data fetching from Urban Data Platform of Hamburg."""

request_timeout: float = 10.0
session: ClientSession | None = None
Expand Down Expand Up @@ -71,7 +67,7 @@ async def _request(
self._close_session = True

try:
async with async_timeout.timeout(self.request_timeout):
async with asyncio.timeout(self.request_timeout):
response = await self.session.request(
method,
url,
Expand Down

0 comments on commit ca8ee66

Please sign in to comment.