hamsclientfork 0.2.14__tar.gz → 0.2.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hamsclientfork-0.2.14/hamsclientfork.egg-info → hamsclientfork-0.2.16}/PKG-INFO +1 -2
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork/client.py +21 -14
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16/hamsclientfork.egg-info}/PKG-INFO +1 -2
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork.egg-info/requires.txt +0 -1
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/setup.py +1 -2
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/.gitignore +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/LICENSE +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/README.md +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/README.rst +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork/__init__.py +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork/__main__.py +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork/py.typed +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork.egg-info/SOURCES.txt +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork.egg-info/dependency_links.txt +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork.egg-info/top_level.txt +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/setup.cfg +0 -0
- {hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hamsclientfork
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: Library to get data from meteo swiss
|
|
5
5
|
Home-page: https://github.com/Rudd-O/hamsclientfork
|
|
6
6
|
Author: websylv
|
|
@@ -16,7 +16,6 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: requests>=2.22.0
|
|
19
|
-
Requires-Dist: pandas>=0.25.3
|
|
20
19
|
Requires-Dist: beautifulsoup4>=4.8.2
|
|
21
20
|
Requires-Dist: geopy>=2.0.0
|
|
22
21
|
|
|
@@ -2,9 +2,9 @@ import geopy
|
|
|
2
2
|
import geopy.distance
|
|
3
3
|
import json
|
|
4
4
|
import logging
|
|
5
|
-
import pandas as pd
|
|
6
5
|
import requests # type: ignore
|
|
7
6
|
import datetime
|
|
7
|
+
import csv
|
|
8
8
|
|
|
9
9
|
from bs4 import BeautifulSoup
|
|
10
10
|
from enum import Enum
|
|
@@ -287,13 +287,17 @@ class meteoSwissClient:
|
|
|
287
287
|
|
|
288
288
|
def get_current_condition(self):
|
|
289
289
|
_LOGGER.debug("Update current condition")
|
|
290
|
-
|
|
290
|
+
with requests.get(CURRENT_CONDITION_URL) as response:
|
|
291
|
+
response.raise_for_status()
|
|
292
|
+
response.encoding = "iso_8859_1"
|
|
293
|
+
lines = response.text.split("\n")
|
|
294
|
+
csv_reader = csv.DictReader(lines, delimiter=";")
|
|
295
|
+
data = [row for row in csv_reader if row]
|
|
291
296
|
conditions = {}
|
|
292
297
|
condition_list = []
|
|
293
298
|
for station in self._stations:
|
|
294
299
|
_LOGGER.debug("Get current condition for : %s" % station)
|
|
295
|
-
stationData =
|
|
296
|
-
stationData = stationData.to_dict("records")
|
|
300
|
+
stationData = [d for d in data if d["Station/Location"] == station]
|
|
297
301
|
condition_list.extend(stationData)
|
|
298
302
|
if stationData:
|
|
299
303
|
conditions[station] = stationData[0]
|
|
@@ -306,16 +310,19 @@ class meteoSwissClient:
|
|
|
306
310
|
|
|
307
311
|
def __get_all_stations(self) -> dict[str, Any]:
|
|
308
312
|
_LOGGER.debug("Getting all stations from : %s" % (STATION_URL))
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
engine="python",
|
|
316
|
-
)
|
|
313
|
+
with requests.get(STATION_URL) as response:
|
|
314
|
+
response.encoding = "iso_8859_1"
|
|
315
|
+
lines = response.text.split("\n")
|
|
316
|
+
csv_reader = csv.DictReader(lines, delimiter=";")
|
|
317
|
+
data = [row for row in csv_reader if row]
|
|
318
|
+
|
|
317
319
|
stationList = {}
|
|
318
|
-
for
|
|
320
|
+
for line in data:
|
|
321
|
+
if (
|
|
322
|
+
line["Type de station"] != STATION_TYPE_PRECIPITATION
|
|
323
|
+
and line["Type de station"] != STATION_TYPE_WEATHER
|
|
324
|
+
):
|
|
325
|
+
continue
|
|
319
326
|
stationData = {}
|
|
320
327
|
stationData["code"] = line["Abr."]
|
|
321
328
|
stationData["name"] = line["Station"]
|
|
@@ -327,7 +334,7 @@ class meteoSwissClient:
|
|
|
327
334
|
elif line["Type de station"] == STATION_TYPE_WEATHER:
|
|
328
335
|
stationData["type"] = StationType.WEATHER
|
|
329
336
|
else:
|
|
330
|
-
|
|
337
|
+
_LOGGER.debug("unknown station type %s" % line["Type de station"])
|
|
331
338
|
stationList[stationData["code"]] = stationData
|
|
332
339
|
return stationList
|
|
333
340
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hamsclientfork
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: Library to get data from meteo swiss
|
|
5
5
|
Home-page: https://github.com/Rudd-O/hamsclientfork
|
|
6
6
|
Author: websylv
|
|
@@ -16,7 +16,6 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: requests>=2.22.0
|
|
19
|
-
Requires-Dist: pandas>=0.25.3
|
|
20
19
|
Requires-Dist: beautifulsoup4>=4.8.2
|
|
21
20
|
Requires-Dist: geopy>=2.0.0
|
|
22
21
|
|
|
@@ -15,7 +15,7 @@ def read(filename):
|
|
|
15
15
|
|
|
16
16
|
setup(
|
|
17
17
|
name="hamsclientfork",
|
|
18
|
-
version="0.2.
|
|
18
|
+
version="0.2.16",
|
|
19
19
|
url="https://github.com/Rudd-O/hamsclientfork",
|
|
20
20
|
license="MIT",
|
|
21
21
|
author="websylv",
|
|
@@ -25,7 +25,6 @@ setup(
|
|
|
25
25
|
packages=find_packages(exclude=("tests",)),
|
|
26
26
|
install_requires=[
|
|
27
27
|
"requests>=2.22.0",
|
|
28
|
-
"pandas>=0.25.3",
|
|
29
28
|
"beautifulsoup4>=4.8.2",
|
|
30
29
|
"geopy>=2.0.0",
|
|
31
30
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hamsclientfork-0.2.14 → hamsclientfork-0.2.16}/hamsclientfork.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|