@@ -3,6 +3,7 @@ bcrypt
flask
flask-Reggie
flask-compress
+requests
pymysql
diff-match-patch
pysha3; python_version < "3.6"
@@ -48,7 +48,11 @@ def api_skin_info_2(conn, name):
get_num = 0
if get_num == 1:
- get_data = urllib.request.urlopen(info_link)
+ try:
+ get_data = urllib.request.urlopen(info_link)
+ except:
+ get_data = None
+
if get_data and get_data.getcode() == 200:
try:
get_data = json.loads(get_data.read().decode())
@@ -13,7 +13,11 @@ def api_version_2(conn, r_ver, c_ver):
else:
up_data = 'stable'
- data = urllib.request.urlopen('https://raw.githubusercontent.com/2du/openNAMU/master/version.json')
+ data = urllib.request.urlopen('https://raw.githubusercontent.com/2du/openNAMU/master/version.json')
+ data = None
if data and data.getcode() == 200:
json_data = json.loads(data.read().decode())
@@ -307,7 +307,7 @@ def captcha_post(re_data, num = 1):
data = urllib.request.urlopen('https://www.google.com/recaptcha/api/siteverify?secret=' + sec_re[0][0] + '&response=' + re_data)
except:
- pass
json_data = json.loads(data.read().decode(data.headers.get_content_charset()))
@@ -30,7 +30,12 @@ def send_parser(data):
if re_data:
re_data = re_data.groups()[0]
- data = re.sub('<a(?: (?:(?:(?!>).)*))?>(?P<in>(?:(?!<).)*)<\/a>', '<a href="/w/' + urllib.parse.quote(re_data).replace('/','%2F') + '">' + re_data + '</a>', data, 1)
+ data = re.sub(
+ '<a(?: (?:(?:(?!>).)*))?>(?P<in>(?:(?!<).)*)<\/a>',
+ '<a href="/w/' + urllib.parse.quote(re_data).replace('/','%2F') + '">' + re_data + '</a>',
+ data,
+ 1
+ )
break