Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import time
|
| 3 |
+
import sched
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
|
| 6 |
+
# μ€μΌμ€λ¬ μ΄κΈ°ν
|
| 7 |
+
s = sched.scheduler(time.time, time.sleep)
|
| 8 |
+
|
| 9 |
+
# URL 리μ€νΈ (μ΄ 100κ°μ URLμ΄ μλ€κ³ κ°μ )
|
| 10 |
+
urls = [
|
| 11 |
+
"https://ginipick-gini-llm-chatbot-text.hf.space",
|
| 12 |
+
"https://ginipick-gini-llm-chat-speech.hf.space",
|
| 13 |
+
"https://ginipick-gini-llm-blog.hf.space",
|
| 14 |
+
"https://fantaxy-kai-chat-speech.hf.space",
|
| 15 |
+
"https://fantaxy-kai-tts.hf.space",
|
| 16 |
+
"https://fantaxy-kai-ytb-audio.hf.space",
|
| 17 |
+
"https://fantaxy-kai-ytb-blog.hf.space",
|
| 18 |
+
"https://fantaxy-kai-girlfriend19.hf.space",
|
| 19 |
+
"https://fantaxy-kai-person-lee.hf.space",
|
| 20 |
+
"https://fantaxy-kai-person-jobs.hf.space",
|
| 21 |
+
"https://fantaxy-kai-person-eins.hf.space",
|
| 22 |
+
"https://fantaxy-kai-person-musk.hf.space",
|
| 23 |
+
"https://fantaxy-kai-person-hwang.hf.space",
|
| 24 |
+
"https://ginipick-kai-commu-1253181171853164544.hf.space",
|
| 25 |
+
"https://ginipick-kai-commu-1253181193180942367.hf.space",
|
| 26 |
+
"https://ginipick-kai-commu-1253181238676557884.hf.space",
|
| 27 |
+
"https://ginipick-kai-commu-1253181258561884161.hf.space",
|
| 28 |
+
"https://ginipick-kai-commu-1253181305739411567.hf.space",
|
| 29 |
+
"https://ginipick-kai-commu-1253181326060949585.hf.space",
|
| 30 |
+
"https://ginipick-kai-commu-1253181359371980892.hf.space",
|
| 31 |
+
"https://ginipick-kai-commu-1253181380091973715.hf.space",
|
| 32 |
+
"https://ginipick-kai-commu-1253181427605045329.hf.space",
|
| 33 |
+
"https://ginipick-kai-commu-1253181449008320553.hf.space",
|
| 34 |
+
"https://ginipick-kai-commu-1253181487818211348.hf.space",
|
| 35 |
+
"https://ginipick-kai-commu-1253181517593837568.hf.space",
|
| 36 |
+
"https://ginipick-kai-commu-1253181557233946665.hf.space",
|
| 37 |
+
"https://ginipick-kai-commu-1253181575252803634.hf.space",
|
| 38 |
+
"https://ginipick-kai-commu-1253181626750341141.hf.space"
|
| 39 |
+
# μ¬κΈ°μ μΆκ° URLμ μΆκ°νμΈμ
|
| 40 |
+
]
|
| 41 |
+
|
| 42 |
+
# URLμ μ μμ μλνλ ν¨μ
|
| 43 |
+
def check_url(url):
|
| 44 |
+
try:
|
| 45 |
+
response = requests.get(url)
|
| 46 |
+
status = response.status_code
|
| 47 |
+
print(f"{datetime.now()}: {url} - μν μ½λ: {status}")
|
| 48 |
+
except requests.RequestException as e:
|
| 49 |
+
print(f"{datetime.now()}: {url} - μ€λ₯: {e}")
|
| 50 |
+
|
| 51 |
+
# λͺ¨λ URLμ 체ν¬νλ ν¨μ
|
| 52 |
+
def check_all_urls():
|
| 53 |
+
for url in urls:
|
| 54 |
+
check_url(url)
|
| 55 |
+
schedule_next_run()
|
| 56 |
+
|
| 57 |
+
# λ€μ μ€νμ μμ½νλ ν¨μ (15λΆλ§λ€ μ€ν)
|
| 58 |
+
def schedule_next_run():
|
| 59 |
+
s.enter(900, 1, check_all_urls) # 900μ΄ = 15λΆ
|
| 60 |
+
print(f"{datetime.now()}: λ€μ μ€νμ΄ μμ½λμμ΅λλ€.")
|
| 61 |
+
|
| 62 |
+
# μ΄κΈ° μ€ν
|
| 63 |
+
print(f"{datetime.now()}: νλ‘κ·Έλ¨ μμ")
|
| 64 |
+
schedule_next_run()
|
| 65 |
+
|
| 66 |
+
# μ€μΌμ€λ¬ μ€ν
|
| 67 |
+
s.run()
|