我尝试使用来自 python 的 POST 请求登录 https://admin.raptor.software,但无法登录。
我正在使用以下代码片段:
import requests_html
session = requests_html.HTMLSession()
r = session.get('https://admin.raptor.software')
csrf = r.html.xpath('/html/head/meta[4]')[0].attrs['content']
data = {
'client_id': '2',
'client_secret': csrf,
'grant_type': 'password',
'password': 'MYPASSWORD',
'username': 'MYEMAIL'
}
session.post('https://admin.raptor.software/api/login', data = data)
我需要用它发布 csrf,因此我使用 requests_html 库来获取它。
成功登录后,我希望使用以下代码打印仪表板 HTML,但它在上面发布了登录页面 HTML:
r = session.get('https://admin.raptor.software/dashboard')
print(r.text)
Admin
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号