hamsclientfork 0.2.13__tar.gz → 0.2.15__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.13/hamsclientfork.egg-info → hamsclientfork-0.2.15}/PKG-INFO +1 -2
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork/client.py +22 -13
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15/hamsclientfork.egg-info}/PKG-INFO +1 -2
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork.egg-info/requires.txt +0 -1
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/setup.py +1 -2
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/.gitignore +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/LICENSE +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/README.md +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/README.rst +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork/__init__.py +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork/__main__.py +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork/py.typed +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork.egg-info/SOURCES.txt +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork.egg-info/dependency_links.txt +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/hamsclientfork.egg-info/top_level.txt +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/setup.cfg +0 -0
- {hamsclientfork-0.2.13 → hamsclientfork-0.2.15}/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.15
|
|
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,7 +287,12 @@ 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:
|
|
@@ -295,7 +300,8 @@ class meteoSwissClient:
|
|
|
295
300
|
stationData = data.loc[data["Station/Location"].str.contains(station)]
|
|
296
301
|
stationData = stationData.to_dict("records")
|
|
297
302
|
condition_list.extend(stationData)
|
|
298
|
-
|
|
303
|
+
if stationData:
|
|
304
|
+
conditions[station] = stationData[0]
|
|
299
305
|
self._condition = condition_list
|
|
300
306
|
self._conditions = conditions
|
|
301
307
|
|
|
@@ -305,16 +311,19 @@ class meteoSwissClient:
|
|
|
305
311
|
|
|
306
312
|
def __get_all_stations(self) -> dict[str, Any]:
|
|
307
313
|
_LOGGER.debug("Getting all stations from : %s" % (STATION_URL))
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
engine="python",
|
|
315
|
-
)
|
|
314
|
+
with requests.get(STATION_URL) as response:
|
|
315
|
+
response.encoding = "iso_8859_1"
|
|
316
|
+
lines = response.text.split("\n")
|
|
317
|
+
csv_reader = csv.DictReader(lines, delimiter=";")
|
|
318
|
+
data = [row for row in csv_reader if row]
|
|
319
|
+
|
|
316
320
|
stationList = {}
|
|
317
|
-
for
|
|
321
|
+
for line in data:
|
|
322
|
+
if (
|
|
323
|
+
line["Type de station"] != STATION_TYPE_PRECIPITATION
|
|
324
|
+
and line["Type de station"] != STATION_TYPE_WEATHER
|
|
325
|
+
):
|
|
326
|
+
continue
|
|
318
327
|
stationData = {}
|
|
319
328
|
stationData["code"] = line["Abr."]
|
|
320
329
|
stationData["name"] = line["Station"]
|
|
@@ -326,7 +335,7 @@ class meteoSwissClient:
|
|
|
326
335
|
elif line["Type de station"] == STATION_TYPE_WEATHER:
|
|
327
336
|
stationData["type"] = StationType.WEATHER
|
|
328
337
|
else:
|
|
329
|
-
|
|
338
|
+
_LOGGER.debug("unknown station type %s" % line["Type de station"])
|
|
330
339
|
stationList[stationData["code"]] = stationData
|
|
331
340
|
return stationList
|
|
332
341
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hamsclientfork
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.15
|
|
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.15",
|
|
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.13 → hamsclientfork-0.2.15}/hamsclientfork.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|