Spaces:
Runtime error
Runtime error
File size: 786 Bytes
1a7ac83 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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()
|