代码拉取完成,页面将自动刷新
from flask import Flask
import datetime, base64, hashlib
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__)
app.config["SECRET_KEY"] = "PaSsw0rD@1234!@#$"
auth = HTTPBasicAuth()
users = {
"admin": "password"
}
@auth.get_password
def get_pw(username):
if username in users:
return users.get(username)
return None
@app.route('/',methods=['GET'])
@auth.login_required
def main():
resp = "nothing"
try:
cur = datetime.datetime.now()
year = cur.year
month = cur.month
day = cur.day
hour = cur.hour
xhstr = "xuehai%d&zhitongyun%d$100fen%d@%d" % (year, month, day, hour)
base64ed = base64.b64encode(xhstr.encode('UTF-8'))
md5ed = hashlib.md5(base64ed+b'\n').hexdigest()
if 12 <= hour and hour <= 24:
resp = md5ed[16:32]
else:
resp = md5ed[0:16]
except:
resp = "error"
return resp
if __name__ == '__main__':
app.run()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。