import time import random import requests SPACES = [ 'https://bjo53-opencode-ai.hf.space/', ] def ping(): while True: for url in SPACES: try: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'Accept': 'text/html', } resp = requests.get(url, headers=headers, timeout=15) print(f'[{time.strftime("%H:%M:%S")}] {url} -> {resp.status_code}', flush=True) except Exception as e: print(f'[{time.strftime("%H:%M:%S")}] {url} -> Error', flush=True) wait = random.randint(180, 600) print(f'Next in {wait//60}m {wait%60}s', flush=True) time.sleep(wait) ping()