simple-dwd-weatherforecast 3.0.1__py3-none-any.whl → 3.0.3__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.
- simple_dwd_weatherforecast/dwdmap.py +11 -28
- {simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/METADATA +1 -1
- {simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/RECORD +6 -6
- {simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/WHEEL +1 -1
- {simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/licenses/LICENCE +0 -0
- {simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/top_level.txt +0 -0
@@ -182,8 +182,10 @@ def get_map(
|
|
182
182
|
layers = f"{','.join(special_layers)},{map_layers},{','.join(other_layers)}".lstrip(
|
183
183
|
","
|
184
184
|
).rstrip(",")
|
185
|
-
|
186
|
-
|
185
|
+
bgcolor = "0xFFFFFF"
|
186
|
+
if dark_mode:
|
187
|
+
bgcolor = "0x1C1C1C"
|
188
|
+
url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.3.0&request=GetMap&layers={layers}&bbox={miny},{minx},{maxy},{maxx}&width={image_width}&height={image_height}&srs=EPSG:4326&styles=&format=image/png&bgcolor={bgcolor}"
|
187
189
|
|
188
190
|
request = requests.get(url, stream=True)
|
189
191
|
if request.status_code == 200:
|
@@ -193,20 +195,10 @@ def get_map(
|
|
193
195
|
raise RuntimeError(
|
194
196
|
f"Error during image request from DWD servers: {url}"
|
195
197
|
) from e
|
196
|
-
if dark_mode:
|
197
|
-
new_image_data = []
|
198
|
-
for item in image.getdata(): # type: ignore
|
199
|
-
if item[0] == 255 and item[1] == 255 and item[2] == 255:
|
200
|
-
new_image_data.append((28, 28, 28))
|
201
|
-
elif item[0] == 85 and item[1] == 85 and item[2] == 85:
|
202
|
-
new_image_data.append((155, 155, 155))
|
203
|
-
else:
|
204
|
-
new_image_data.append(item)
|
205
|
-
|
206
|
-
# update image data
|
207
|
-
image.putdata(new_image_data)
|
208
198
|
image = draw_marker(image, ImageBoundaries(minx, maxx, miny, maxy), markers)
|
209
199
|
return image
|
200
|
+
else:
|
201
|
+
raise ConnectionError(f"Error during image request from DWD servers: {url}")
|
210
202
|
|
211
203
|
|
212
204
|
class ImageLoop:
|
@@ -328,28 +320,19 @@ class ImageLoop:
|
|
328
320
|
","
|
329
321
|
).rstrip(",")
|
330
322
|
)
|
331
|
-
|
323
|
+
bgcolor = "0xFFFFFF"
|
324
|
+
if self.dark_mode:
|
325
|
+
bgcolor = "0x1C1C1C"
|
326
|
+
url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.3.0&request=GetMap&layers={layers}&bbox={self._miny},{self._minx},{self._maxy},{self._maxx}&width={self._image_width}&height={self._image_height}&srs=EPSG:4326&styles=&format=image/png&TIME={date.strftime('%Y-%m-%dT%H:%M:00.0Z')}&bgcolor={bgcolor}"
|
332
327
|
request = requests.get(url, stream=True)
|
333
328
|
if request.status_code != 200 or request.headers["content-type"] != "image/png":
|
334
|
-
raise ConnectionError("Error during image request from DWD servers")
|
329
|
+
raise ConnectionError(f"Error during image request from DWD servers: {url}")
|
335
330
|
try:
|
336
331
|
image = Image.open(BytesIO(request.content))
|
337
332
|
except Exception as e:
|
338
333
|
raise RuntimeError(
|
339
334
|
f"Error during image request from DWD servers: {url}"
|
340
335
|
) from e
|
341
|
-
if self.dark_mode:
|
342
|
-
new_image_data = []
|
343
|
-
for item in image.getdata(): # type: ignore
|
344
|
-
if item[0] == 255 and item[1] == 255 and item[2] == 255:
|
345
|
-
new_image_data.append((28, 28, 28))
|
346
|
-
elif item[0] == 85 and item[1] == 85 and item[2] == 85:
|
347
|
-
new_image_data.append((155, 155, 155))
|
348
|
-
else:
|
349
|
-
new_image_data.append(item)
|
350
|
-
|
351
|
-
# update image data
|
352
|
-
image.putdata(new_image_data)
|
353
336
|
image = draw_marker(
|
354
337
|
image,
|
355
338
|
ImageBoundaries(self._minx, self._maxx, self._miny, self._maxy),
|
{simple_dwd_weatherforecast-3.0.1.dist-info → simple_dwd_weatherforecast-3.0.3.dist-info}/RECORD
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
simple_dwd_weatherforecast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
simple_dwd_weatherforecast/dwdforecast.py,sha256=uZRWMN9RIPvC9r47JAdw_AiP9V9M2rQxh_pOsVF15Sw,39094
|
3
|
-
simple_dwd_weatherforecast/dwdmap.py,sha256=
|
3
|
+
simple_dwd_weatherforecast/dwdmap.py,sha256=I_C0MPK7RlbtNGOpxGl5Oy4rm-XEB_gIbLunV0y76HI,13691
|
4
4
|
simple_dwd_weatherforecast/stations.json,sha256=1u8qc2CT_rVy49SAlOicGixzHln6Y0FXevuFAz2maBw,838948
|
5
5
|
simple_dwd_weatherforecast/uv_stations.json,sha256=ADenYo-aR6qbf0UFkfYr72kkFzL9HyUKe4VQ23POGF8,2292
|
6
|
-
simple_dwd_weatherforecast-3.0.
|
6
|
+
simple_dwd_weatherforecast-3.0.3.dist-info/licenses/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
|
7
7
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
tests/dummy_data.py,sha256=qapeQxjh8kURf5b-9h4gUdJaqQJQDVdqfMtS2g5JReY,103406
|
9
9
|
tests/dummy_data_full.py,sha256=3HRGAQBq4xPYs4jLzoLV_UAe1CXFzOsVBOouDL_5RHw,104062
|
@@ -36,7 +36,7 @@ tests/test_update.py,sha256=AIzzHMxcjwQjeTB0l3YFgB7HkGDbuqiHofwy41mS0m4,7440
|
|
36
36
|
tests/test_update_hourly.py,sha256=7Zl8ml3FTdqw3_Qwr_Tz-sWTzypvrBWmxeig2Vwp_ZQ,1781
|
37
37
|
tests/test_uv_index.py,sha256=tr6wnOyHlXT1S3yp1oeHc4-Brmc-EMEdM4mtyrdpcHg,579
|
38
38
|
tests/test_weather.py,sha256=ZyX4ldUoJpJp7YpiNQwU6Od-nYRay-3qcaDJdNq8fhY,780
|
39
|
-
simple_dwd_weatherforecast-3.0.
|
40
|
-
simple_dwd_weatherforecast-3.0.
|
41
|
-
simple_dwd_weatherforecast-3.0.
|
42
|
-
simple_dwd_weatherforecast-3.0.
|
39
|
+
simple_dwd_weatherforecast-3.0.3.dist-info/METADATA,sha256=kDbBjTJiY0xUAJnDea87paaLvhAaX3UAmC_du1w0w3U,12869
|
40
|
+
simple_dwd_weatherforecast-3.0.3.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
41
|
+
simple_dwd_weatherforecast-3.0.3.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
|
42
|
+
simple_dwd_weatherforecast-3.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|