diff --git a/README.md b/README.md index 86d7ffd..91a76b2 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ async def main(): try: async with ClientSession() as websession: gios = Gios(GIOS_STATION_ID, websession) - data = await gios.update() + data = await gios.async_update() except (ApiError, NoStationError, InvalidSensorsData, ClientError) as error: print(f"{error}") return diff --git a/example.py b/example.py index 61daff7..b1fb73f 100644 --- a/example.py +++ b/example.py @@ -12,7 +12,7 @@ async def main(): try: async with ClientSession() as websession: gios = Gios(GIOS_STATION_ID, websession) - data = await gios.update() + data = await gios.async_update() except (ApiError, NoStationError, InvalidSensorsData, ClientError) as error: print(f"{error}") return diff --git a/gios/__init__.py b/gios/__init__.py index 69fb230..b57ac0d 100644 --- a/gios/__init__.py +++ b/gios/__init__.py @@ -36,7 +36,7 @@ def __init__(self, station_id: str, session: ClientSession) -> None: self.session = session - async def update(self) -> Dict[str, Any]: # pylint:disable=too-many-branches + async def async_update(self) -> Dict[str, Any]: # pylint:disable=too-many-branches """Update GIOS data.""" data: Dict[str, Dict[str, Any]] = {} invalid_sensors: List[str] = [] diff --git a/tests/test_init.py b/tests/test_init.py index a826300..97b0cc0 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -84,7 +84,7 @@ async def test_valid_data_first_value(): # pylint:disable=too-many-statements ) gios = Gios(VALID_STATION_ID, session) - data = await gios.update() + data = await gios.async_update() await session.close() @@ -122,7 +122,7 @@ async def test_api_error(): ) gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except ApiError as error: assert str(error.status) == "404" @@ -206,7 +206,7 @@ async def test_valid_data_second_value(): # pylint:disable=too-many-statements ) gios = Gios(VALID_STATION_ID, session) - data = await gios.update() + data = await gios.async_update() await session.close() @@ -300,7 +300,7 @@ async def test_no_indexes_data(): gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except InvalidSensorsData as error: assert str(error.status) == "Invalid index data from GIOS API" @@ -392,7 +392,7 @@ async def test_no_sensor_data_1(): # pylint:disable=too-many-statements gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except InvalidSensorsData as error: assert str(error.status) == "Invalid sensor data from GIOS API" @@ -449,7 +449,7 @@ async def test_invalid_sensor_data_2(): gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except InvalidSensorsData as error: assert str(error.status) == "Invalid sensor data from GIOS API" @@ -475,7 +475,7 @@ async def test_no_station_data(): ) gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except InvalidSensorsData as error: assert str(error.status) == "Invalid measuring station data from GIOS API" @@ -494,7 +494,7 @@ async def test_no_stations_data(): ) gios = Gios(VALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except ApiError as error: assert str(error.status) == "Invalid measuring stations list from GIOS API" @@ -517,7 +517,7 @@ async def test_invalid_station_id(): gios = Gios(INVALID_STATION_ID, session) try: - await gios.update() + await gios.async_update() except NoStationError as error: assert str(error.status) == "0 is not a valid measuring station ID"