-
Notifications
You must be signed in to change notification settings - Fork 0
/
__main__.py
45 lines (40 loc) · 1002 Bytes
/
__main__.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
Copyright Ghink Network Studio © 2014
MIT Fengming High School Techy Group & Radio Station
Website: https://www.ghink.net, https://radio.fmhs.club, https://techy.fmhs.club
Main Program by Bigsk (https://www.xiaxinzhe.cn)
'''
from __init__ import *
import route
import os, json
from threading import Thread
from flask import Flask
from urllib.request import urlopen
# Define network check function
def network(source = r"http://www.baidu.com", retry = 3):
flag = False
for _ in range(retry):
try:
fp = urlopen(source)
fp.read(100).decode()
fp.close()
except:
pass
else:
flag = True
return flag
# Define json check function
def check_json(content):
try:
json.loads(content)
except:
return False
else:
return True
finally:
return False
# Define main function
def main():
APP.run("127.0.0.1", 8000)
if __name__ == "__main__":
main()