Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: get_historical_data returns warning and empty dataframe #177

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
7 changes: 5 additions & 2 deletions src/ozon3/ozon3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, :]

Expand Down
Loading