TEST Webcam

import requests from datetime import datetime # URL der IP-Kamera url = "http://109.91.157.77/snapshot.jpg" # Speicherpfad oder Upload-Ziel save_path = "/path/to/save/images" upload_url = "http://yourserver.com/upload" def fetch_and_save_image(): response = requests.get(url) if response.status_code == 200: timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"{save_path}/weather_{timestamp}.jpg" with open(filename, "wb") as f: f.write(response.content) upload_image(filename) else: print("Failed to retrieve image") def upload_image(filepath): with open(filepath, 'rb') as f: response = requests.post(upload_url, files={'file': f}) if response.status_code == 200: print("Upload successful") else: print("Upload failed") # Regelmäßiges Abrufen und Speichern der Bilder import time while True: fetch_and_save_image() time.sleep(3600) # Warte eine Stunde bis zum nächsten Abruf