simple-dwd-weatherforecast 2.1.2__py3-none-any.whl → 2.1.4__py3-none-any.whl

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.
@@ -951,21 +951,31 @@ class Weather:
951
951
  except Exception as error:
952
952
  print(f"Error in download_latest_kml: {type(error)} args: {error.args}")
953
953
 
954
- def get_chunks(self):
955
- def zipped_chunks():
954
+ def get_chunks(self, url):
955
+ def zipped_chunks(url):
956
956
  # Iterable that yields the bytes of a zip file
957
957
  with httpx.stream(
958
958
  "GET",
959
- "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_S/all_stations/kml/MOSMIX_S_LATEST_240.kmz",
959
+ url,
960
960
  ) as r:
961
- yield from r.iter_bytes(chunk_size=131072)
961
+ self.etags[url] = r.headers["etag"] # type: ignore
962
+ yield from r.iter_bytes(chunk_size=171072)
962
963
 
963
- return stream_unzip(zipped_chunks())
964
+ return stream_unzip(zipped_chunks(url))
964
965
 
965
966
  def download_large_kml(self, stationid):
966
967
  placemark = b""
968
+ url = "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_S/all_stations/kml/MOSMIX_S_LATEST_240.kmz"
969
+ # Check if content has updated
970
+ headers = {"If-None-Match": self.etags[url] if url in self.etags else ""} # type: ignore
971
+ r = httpx.head(
972
+ url,
973
+ headers=headers,
974
+ )
975
+ if r.status_code == 304:
976
+ return
967
977
 
968
- for file_name, file_size, unzipped_chunks in self.get_chunks():
978
+ for file_name, file_size, unzipped_chunks in self.get_chunks(url):
969
979
  chunk1 = b""
970
980
  chunk2 = b""
971
981
  first_chunk = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple_dwd_weatherforecast
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: A simple tool to retrieve a weather forecast from DWD OpenData
5
5
  Home-page: https://github.com/FL550/simple_dwd_weatherforecast.git
6
6
  Author: Max Fermor
@@ -14,6 +14,8 @@ Requires-Dist: lxml
14
14
  Requires-Dist: requests
15
15
  Requires-Dist: Pillow
16
16
  Requires-Dist: arrow
17
+ Requires-Dist: stream-unzip
18
+ Requires-Dist: httpx
17
19
 
18
20
  # Simple DWD weather forecast
19
21
 
@@ -1,5 +1,5 @@
1
1
  simple_dwd_weatherforecast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- simple_dwd_weatherforecast/dwdforecast.py,sha256=te_MIe6GzZ32UWrDTpbqJdHk0hFhs9dqN4h2rS3J-yA,38247
2
+ simple_dwd_weatherforecast/dwdforecast.py,sha256=pMJpl7yHV_xFFdpYlpU8wYZOv4_ZBkx-JAkrXMvYOI4,38616
3
3
  simple_dwd_weatherforecast/dwdmap.py,sha256=cPCcL1u5qeIEDLBcL0qOH0-7dPIi3mge4-PUqfZlRQc,6737
4
4
  simple_dwd_weatherforecast/stations.json,sha256=1u8qc2CT_rVy49SAlOicGixzHln6Y0FXevuFAz2maBw,838948
5
5
  simple_dwd_weatherforecast/uv_stations.json,sha256=ADenYo-aR6qbf0UFkfYr72kkFzL9HyUKe4VQ23POGF8,2292
@@ -35,8 +35,8 @@ tests/test_update.py,sha256=AIzzHMxcjwQjeTB0l3YFgB7HkGDbuqiHofwy41mS0m4,7440
35
35
  tests/test_update_hourly.py,sha256=7Zl8ml3FTdqw3_Qwr_Tz-sWTzypvrBWmxeig2Vwp_ZQ,1781
36
36
  tests/test_uv_index.py,sha256=tr6wnOyHlXT1S3yp1oeHc4-Brmc-EMEdM4mtyrdpcHg,579
37
37
  tests/test_weather.py,sha256=ZyX4ldUoJpJp7YpiNQwU6Od-nYRay-3qcaDJdNq8fhY,780
38
- simple_dwd_weatherforecast-2.1.2.dist-info/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
39
- simple_dwd_weatherforecast-2.1.2.dist-info/METADATA,sha256=U8Nf45jVUBJipMq-HRG7zd9ILGyn_ezc_dv6ctF9uGs,12054
40
- simple_dwd_weatherforecast-2.1.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
41
- simple_dwd_weatherforecast-2.1.2.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
42
- simple_dwd_weatherforecast-2.1.2.dist-info/RECORD,,
38
+ simple_dwd_weatherforecast-2.1.4.dist-info/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
39
+ simple_dwd_weatherforecast-2.1.4.dist-info/METADATA,sha256=AEI5eiSQsYm-_W8md8MAiG9xcPrSdT6pFSULJ4Ux1xQ,12103
40
+ simple_dwd_weatherforecast-2.1.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
41
+ simple_dwd_weatherforecast-2.1.4.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
42
+ simple_dwd_weatherforecast-2.1.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5