有需要的自行挂到云函数。。。菜鸡新手,写的不好请多包涵![Python] 纯文本查看 复制代码 import requests
import json
def login():
# 需要访问的URL
url = 'https://miuiver.com/wp-content/plugins/erphplogin//action/login.php'
userprofile = 'https://miuiver.com/user-profile/'
sign_in = 'https://miuiver.com/wp-admin/admin-ajax.php'
# 保持登陆,并返回COOKIE
s = requests.session()
# POST数据
postdate = {
'log': '账号',
'pwd': '密码',
'action': 'mobantu_login',
}
# 请求头
headers = {
'referer': 'https://miuiver.com/',
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 '
'Safari/537.36',
}
# 登陆
request = s.post(url=url, data=postdate, headers=headers)
# print(request.text)
# 访问个人页面
request_1 = s.get(url=userprofile)
# print(request_1.text)
# 签到POSData
sign_data = {'action': 'epd_checkin'}
sign = s.post(url=sign_in, data=sign_data)
sign_1 = sign.text.encode('utf-8').decode("unicode_escape")
if sign_1[0] == 200:
print("签到成功", sign_1)
else:
print("签到失败", sign_1)
if __name__ == '__main__':
login()
|