File size: 845 Bytes
68c2266
 
 
60c3505
68c2266
60c3505
68c2266
 
60c3505
 
 
 
 
 
 
 
68c2266
60c3505
 
68c2266
 
60c3505
 
68c2266
60c3505
 
 
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
28
import time
import random
import requests
import threading

def ping(url, name):
    while True:
        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'[{name}] {time.strftime("%H:%M:%S")} -> {resp.status_code}', flush=True)
        except:
            print(f'[{name}] Error', flush=True)
        
        wait = random.randint(900, 3600)
        print(f'[{name}] Next {wait//60}m', flush=True)
        time.sleep(wait)

# Ping keep-alive space back
threading.Thread(target=ping, args=('https://bjo53-keep-alive.hf.space/', 'KeepAlive'), daemon=True).start()

print('[Mutual] Started', flush=True)
while True:
    time.sleep(60)