v.0.11.2 added beautyful soup bs4

This commit is contained in:
tiijay
2025-11-21 15:06:04 +00:00
parent 3a8fb95f4f
commit c27b97fc71
9 changed files with 73 additions and 60 deletions

View File

@@ -15,16 +15,20 @@ class API_Server_Checker:
else f"{BASE_API_URL}/items/{item_id}"
)
print(f"query: {items_url}")
r = urequests.get(items_url)
print("Status-Code:", r.status_code)
json_resp = r.json()
if r.status_code == 200:
print("json_resp:", json_resp)
else:
print("api-server error:", json_resp["error"]["message"])
try:
r = urequests.get(items_url)
print("Status-Code:", r.status_code)
json_resp = r.json()
r.close()
if r.status_code == 200:
print("json_resp:", json_resp)
else:
print("api-server error:", json_resp["error"]["message"])
except OSError as e:
print(f"api-server call failed: {e}")
finally:
r.close()
def check(self, item_id: int):
self._get_items(item_id)

View File

@@ -123,19 +123,16 @@ class Weather_Checker:
color=colors.RAINBOW[2],
)
ypos += self.display.font_height + 1
updated_time_str: str = str(w_resp.weather.current.last_updated)[-5:]
local_time_str: str = str(w_resp.weather.location.localtime)[-5:]
self.display.write_text(
f"upd:{str(w_resp.weather.current.last_updated)[-5:]}",
f"{local_time_str} {updated_time_str}",
0,
ypos,
color=colors.RAINBOW[3],
)
ypos += self.display.font_height + 1
self.display.write_text(
f"cur:{str(w_resp.weather.location.localtime)[-5:]}",
0,
ypos,
color=colors.RAINBOW[4],
)
else:
ypos = 0
self.display.write_text(