好友
阅读权限10
听众
最后登录1970-1-1
|
本帖最后由 dft2010 于 2021-11-25 11:10 编辑
本地运行正常,但部署到云函数就报错,求大佬指点迷津~
JSON
{
"errorCode": -1,
"errorMessage": "user code exception caught",
"requestId": "4e6d0b07-6245-46fa-a59d-1a19675ef2b2",
"stackTrace": "Traceback (most recent call last):\nTypeError: login() takes 0 positional arguments but 2 were given",
"statusCode": 430
}
[Python] 纯文本查看 复制代码 import requests
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 = sign.text
if sign[0] == 200:
print("签到成功", sign)
else:
print("签到失败", sign)
exit(0)
# if __name__ == '__main__':
# login()
|
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|