v.0.11.0 ap-server & pico-client

This commit is contained in:
tiijay
2025-11-20 19:42:50 +01:00
parent 00c24110ee
commit 2233be7987
11 changed files with 213 additions and 21 deletions

View File

@@ -1,13 +1,3 @@
#Moin from VSCode
# FROM python:3.13-slim
# RUN apt-get update && apt-get install -y \
# git \
# curl \
# wget \
# && rm -rf /var/lib/apt/lists/*
FROM python:3.13-alpine
RUN apk add --no-cache \
git \

View File

@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
"name": "Pico-Client",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile"
@@ -23,7 +23,8 @@
"wayou.vscode-todo-highlight",
"charliermarsh.ruff",
"wokwi.wokwi-vscode",
"humao.rest-client"
"humao.rest-client",
"tamasfe.even-better-toml"
]
}
},
@@ -33,7 +34,7 @@
// More info: https://containers.dev/implementors/json_reference/#port-attributes
"portsAttributes": {
"9000": {
"label": "Flask Application",
"label": "Pico-W Application",
"onAutoForward": "notify"
}
},

View File

@@ -1,6 +1,6 @@
from display import NeoPixel_64x64
from display.fonts import font_5x7
from tryout import Font_Checker, Weather_Checker, Emoji_Checker
from tryout import Font_Checker, Weather_Checker, Emoji_Checker, API_Server_Checker
from utils import show_system_load
from utils import (
sync_ntp_time,
@@ -12,12 +12,12 @@ from utils.digital_clock import DigitalClock
import uasyncio as asyncio # type: ignore
from web import Wlan
CITY_LIST: list[str] = sorted(
["Großhansdorf", "Columbus", "London", "Ebeltoft", "Tokio"]
)
async def weather_check_task(weather_checker: Weather_Checker):
CITY_LIST: list[str] = sorted(
["Großhansdorf", "Columbus", "London", "Ebeltoft", "Tokio"]
)
while True:
for city in CITY_LIST:
weather_checker.check(city=city, lang="de", test_mode=True)
@@ -63,7 +63,9 @@ if __name__ == "__main__":
# emoji_checker : Emoji_Checker = Emoji_Checker(display)
# emoji_checker.check()
# tryout.weather_check(display, test_mode=False)
api_server_check_task: API_Server_Checker = API_Server_Checker()
api_server_check_task.check()
display.set_font(font_5x7)
weather_checker: Weather_Checker = Weather_Checker(display=display)

View File

@@ -0,0 +1,7 @@
### all Items
### FIXME: wie erreiche ich den Server aus dem Container
GET http://api-server-admin-:8000/items
Accept: application/json
###
GET http://0.0.0.0:8000/items

View File

@@ -1,5 +1,6 @@
from .font_checker import Font_Checker
from .weather_checker import Weather_Checker
from .emoji_checker import Emoji_Checker
from .api_server_checker import API_Server_Checker
__all__ = [ 'Font_Checker', 'Weather_Checker', 'Emoji_Checker']
__all__ = ["Font_Checker", "Weather_Checker", "Emoji_Checker", "API_Server_Checker"]

View File

@@ -0,0 +1,20 @@
import urequests # type: ignore
import json
BASE_API_URL: str = "http://0.0.0.0:8000"
class API_Server_Checker:
def __init__(self):
pass
def _get_items(self):
items_url: str = f"{BASE_API_URL}/items"
print(f"query: {items_url}")
r = urequests.get(items_url)
print("Status-Code:", r.status_code)
json_resp = r.json()
print("json_resp:", json_resp)
def check(self):
self._get_items()