diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d67c5..959d366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.5 (2025-05-24) +### Fixed +- Fix BB encoding + ## 1.0.4 (2024-12-24) ### Fixed - Fix NI invalid values diff --git a/LICENSE b/LICENSE index 30c31c0..b93eb01 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 stephan192 +Copyright (c) 2025 stephan192 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/update_pegel_list.py b/docs/update_pegel_list.py index 0e5a30d..7ccd640 100644 --- a/docs/update_pegel_list.py +++ b/docs/update_pegel_list.py @@ -94,7 +94,9 @@ def fix_bb_encoding(string_in: str) -> str: def get_bb_stations() -> tuple[str, str]: """Get all available stations for Brandenburg.""" stations = [] - page = fetch_text("https://pegelportal.brandenburg.de/start.php") + page = fetch_text( + "https://pegelportal.brandenburg.de/start.php", forced_encoding="ISO-8859-15" + ) lines = page.split("\n") start_found = False for line in lines: diff --git a/pyproject.toml b/pyproject.toml index de98757..157b904 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "lhpapi" -version = "1.0.4" +version = "1.0.5" authors = [ { name="stephan192", email="stephan192@outlook.com" }, ] diff --git a/src/lhpapi/bb_api.py b/src/lhpapi/bb_api.py index 8a7d54b..44bf6b6 100644 --- a/src/lhpapi/bb_api.py +++ b/src/lhpapi/bb_api.py @@ -70,7 +70,10 @@ def init_BB(ident: str) -> StaticData: # pylint: disable=invalid-name """Init data for Brandenburg.""" try: # Get data - page = fetch_text("https://pegelportal.brandenburg.de/start.php") + page = fetch_text( + "https://pegelportal.brandenburg.de/start.php", + forced_encoding="ISO-8859-15", + ) lines = page.split("\n") # Parse data start_found = False @@ -105,7 +108,10 @@ def update_BB(static_data: StaticData) -> DynamicData: # pylint: disable=invali """Update data for Brandenburg.""" try: # Get data - page = fetch_text("https://pegelportal.brandenburg.de/start.php") + page = fetch_text( + "https://pegelportal.brandenburg.de/start.php", + forced_encoding="ISO-8859-15", + ) lines = page.split("\n") # Parse data start_found = False diff --git a/tests/test_lhpapi.py b/tests/test_lhpapi.py index 34ebd3c..d8773a4 100644 --- a/tests/test_lhpapi.py +++ b/tests/test_lhpapi.py @@ -10,7 +10,7 @@ MAX_STAGE = 4 testdata = [ - ("BB_5804300", "Ketzin / Havel", True, True, True), + ("BB_6602200", "Klein Bademeusel / Lausitzer Neiße", True, True, True), ("BE_5866301", "Zoo / Landwehrkanal", True, False, True), ("BW_00102", "Rottenburg / Bronnbachquelle", True, True, True), ("BY_16005701", "München / Isar", True, True, True),