bet365登录请求

2024-09-28 05:28:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试为登录bet365制作一个脚本。我被暂停登录。POST请求的参数为:

LOGIN_URL = "https://mobile.bet365.it/"
{
   DeviceId : "..."
   Platform : "..."
   txtPassword: "..."
   tktTKN: "..."
   txtType: "..."
   txtUsername: "..."
}

所以我编写了这个payload来尝试访问登录页面:

^{pr2}$

我完全确定这些值是正确的(除了platform和txtType,因为我不明白它们是什么,所以我复制了登录时总是设置的值)。 但是,如果我试图检查我是否登录,我意识到我没有。在


Tags: https脚本url参数loginitmobilepost
2条回答

Chrome告诉我要发布到的登录页面是这个页面:

https://mobile.bet365.it/members/lp/default.aspx

为什么你认为这是你列出的网址?在

(我假设登录页面中没有明显的“登录失败”消息) 通常,您登录的事实是“保存”在1个或多个cookies(*sessionID)中,所以我要做的是在“登录请求”的响应中查找它们,并将它们添加到以下请求中。在

我的一些代码中有一个片段可以告诉你大概的想法

import httplib2
headers = {
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'accept-encoding': "identity", ...
        }
payload = { ... }
http_client = httplib2.Http()
response, content = http_client.request(
                    login_url,
                    "POST",
                    urllib.urlencode(payload),
                    headers)
# ...
cookie = response.get("set-cookie")
if cookie:
    headers['Cookie'] = cookie  
# ...
 response, content = http_client.request(
                    other_url,
                    "POST",
                    urllib.urlencode(payload),
                    headers)

相关问题 更多 >

    热门问题