Last few tweaks

This commit is contained in:
2026-03-15 15:30:16 -04:00
parent f64860125c
commit 7f296f9857
3 changed files with 25 additions and 2 deletions

20
Provider/fetch_png.py Normal file
View File

@@ -0,0 +1,20 @@
import urllib.request
import json
import time
# 1. Register a fake device
req = urllib.request.Request('http://calendink.local/api/devices/register', data=json.dumps({'mac': 'DE:BU:G0:44:55:66'}).encode('utf-8'), headers={'Content-Type': 'application/json'})
try:
with urllib.request.urlopen(req) as response:
print("Registered:", response.read().decode())
except Exception as e:
print("Error registering:", e)
time.sleep(1)
# 2. Download the PNG
try:
urllib.request.urlretrieve('http://calendink.local/api/devices/screen.png?mac=DE:BU:G0:44:55:66', 'test_png.png')
print("Downloaded test_png.png")
except Exception as e:
print("Error downloading PNG:", e)