Upload wk.py
Browse files
wk.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from apscheduler.schedulers.blocking import BlockingScheduler
|
2 |
+
import requests
|
3 |
+
|
4 |
+
url = "https://geek7-tmgztxi.hf.space"
|
5 |
+
|
6 |
+
scheduler = BlockingScheduler()
|
7 |
+
|
8 |
+
def ping():
|
9 |
+
try:
|
10 |
+
response = requests.get(url)
|
11 |
+
print(f"Pinged {url}: {response.status_code}")
|
12 |
+
except Exception as e:
|
13 |
+
print(f"Error pinging {url}: {e}")
|
14 |
+
|
15 |
+
|
16 |
+
scheduler.add_job(ping, 'interval', minutes=5)
|
17 |
+
|
18 |
+
try:
|
19 |
+
scheduler.start()
|
20 |
+
except (KeyboardInterrupt, SystemExit):
|
21 |
+
pass
|