diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index efa3019..8713fd3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: 'v0.941' # Use the sha / tag to point at specific version hooks: - id: mypy - additional_dependencies: ['types-requests', 'types-urllib3'] + additional_dependencies: ['types-requests==2.31.0.1', 'types-urllib3'] - repo: https://github.com/psf/black rev: '22.3.0' hooks: diff --git a/pyproject.toml b/pyproject.toml index b5a3c46..374b58c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,4 @@ requires = [ "setuptools>=42", "wheel" ] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" diff --git a/src/ozon3/ozon3.py b/src/ozon3/ozon3.py index 967caaf..5c74c75 100644 --- a/src/ozon3/ozon3.py +++ b/src/ozon3/ozon3.py @@ -558,10 +558,13 @@ def get_historical_data( # Take first search result search_result = self.get_city_station_options(city) if len(search_result) == 0: - raise Exception( + warnings.warn( f'The search for city "{city}" returns no result. It is possible ' - "that the city does not have AQI station." + "that the city does not have an AQI station." ) + return ( + pandas.DataFrame() + ) # Return an empty DataFrame to avoid further errors. first_result = search_result.iloc[0, :]