hamsclientfork 0.2.14__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hamsclientfork
3
- Version: 0.2.14
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
- data = pd.read_csv(CURRENT_CONDITION_URL, sep=";", header=0)
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:
@@ -306,16 +311,19 @@ class meteoSwissClient:
306
311
 
307
312
  def __get_all_stations(self) -> dict[str, Any]:
308
313
  _LOGGER.debug("Getting all stations from : %s" % (STATION_URL))
309
- data = pd.read_csv(
310
- STATION_URL,
311
- sep=";",
312
- header=0,
313
- skipfooter=4,
314
- encoding="latin1",
315
- engine="python",
316
- )
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
+
317
320
  stationList = {}
318
- for index, line in data.iterrows():
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
319
327
  stationData = {}
320
328
  stationData["code"] = line["Abr."]
321
329
  stationData["name"] = line["Station"]
@@ -327,7 +335,7 @@ class meteoSwissClient:
327
335
  elif line["Type de station"] == STATION_TYPE_WEATHER:
328
336
  stationData["type"] = StationType.WEATHER
329
337
  else:
330
- assert 0, "unknown station type %s" % line["Type de station"]
338
+ _LOGGER.debug("unknown station type %s" % line["Type de station"])
331
339
  stationList[stationData["code"]] = stationData
332
340
  return stationList
333
341
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hamsclientfork
3
- Version: 0.2.14
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
 
@@ -1,4 +1,3 @@
1
1
  requests>=2.22.0
2
- pandas>=0.25.3
3
2
  beautifulsoup4>=4.8.2
4
3
  geopy>=2.0.0
@@ -15,7 +15,7 @@ def read(filename):
15
15
 
16
16
  setup(
17
17
  name="hamsclientfork",
18
- version="0.2.14",
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