Carpincho/test/Send_GET.py
2025-11-16 18:06:19 -03:00

54 lines
1.3 KiB
Python

import requests
import time
# Configuración: IP y puerto del servidor
ip_destino = '192.168.1.220'
puerto = 5000 # Cambialo por el puerto que necesites
# Intervalo de envío en segundos
intervalo_segundos = 10
# Construcción del URL base con puerto incluido
url_base = f'http://{ip_destino}:{puerto}/datos'
# Parámetros del GET
params = {
'ID': '1',
'PASSWORD': '1111',
'tempf': '63.5',
'humidity': '56',
'dewptf': '47.7',
'windchillf': '63.5',
'winddir': '68',
'windspeedmph': '0.00',
'windgustmph': '0.00',
'rainin': '0.000',
'dailyrainin': '0.000',
'weeklyrainin': '0.000',
'monthlyrainin': '0.000',
'yearlyrainin': '0.020',
'totalrainin': '0.020',
'solarradiation': '0.00',
'UV': '0',
'indoortempf': '67.8',
'indoorhumidity': '70',
'absbaromin': '29.831',
'baromin': '29.908',
'lowbatt': '0',
'dateutc': 'now',
'softwaretype': 'EasyWeatherPro_V5.2.2',
'action': 'updateraw',
'realtime': '1',
'rtfreq': '5'
}
# Bucle infinito que envía el GET cada X segundos
while True:
try:
response = requests.get(url_base, params=params)
print(f"[{time.strftime('%H:%M:%S')}] Status {response.status_code} - {response.url}")
except Exception as e:
print(f"❌ Error enviando request: {e}")
time.sleep(intervalo_segundos)