python请求响应的问题,浏览器中的不同答案和需求中的另一个

72qzrwbm  于 2023-06-04  发布在  Python
关注(0)|答案(1)|浏览(102)

我试图发送一个登录https://account.efortuna.pl/login的请求,当我发送请求时,我得到了答案:你不能,因为你已经超过了登录限制错误代码3,在浏览器中,当输入相同的数据,一个关于错误的登录数据错误代码2,我不知道为什么我在查询中得到不同的答案。

import json
import time

s = requests.Session()
params = {
    'casinoname': 'efortuna.pl',
    'realMode': '1',
    'serviceType': 'GamePlay',
    'clientType': 'sportsbook',
    'clientPlatform': 'web',
    'clientVersion': '10H',
    'clientSkin': 'efortuna.pl',
    'deliveryPlatform': 'Hub2',
    'deviceType': 'other',
    'osName': 'windows',
    'osVersion': '10',
    'deviceBrowser': 'chrome',
    'languageCode': 'pl',
    #'redirectUrl': 'https://www.efortuna.pl/#requestId=',
    'messagesSupported': '1'
}

payload = {
    'username': 'myusername',
    'password': 'mypassword',
    'eventOrigin': 'https://www.efortuna.pl',
    'hr': 'https://account.efortuna.pl/',
    'requestsType': 'LoginAndGetTempToken',
    'responseType': 'json'
}

s.get("https://account.efortuna.pl/login")
res = s.post('https://login.efortuna.pl/LoginAndGetTempToken.php', json=payload, data=params, verify=False)
print(res.content)

***浏览器响应:***错误代码:2个播放器留言:“昵称或密码无效。请联系callcenter@efortuna.pl客户服务寻求帮助”
***响应Python请求***错误代码:3播放器留言:“您无法登录,因为您已超时。”

qvtsj1bj

qvtsj1bj1#

不幸的是,我不懂英语,所以我用翻译。要登录到您的帐户与此庄家,你需要做5连接:
1.从“https://www.efortuna.pl/login”获取,我们在这里下载下一个查询的cookie。
2.从“https://login.efortuna.pl/pasSetupPage.php?casino=efortuna.pl”获取,我们还下载了下一个查询的cookie。
3.从地址“https://login.efortuna.pl/Login.php?casinoname=efortuna.pl&realMode=1&clientType=sportsbook&clientPlatform=web&clientSkin=efortuna.pl&languageCode=pl&redirectUrl=https://www.efortuna.pl/#requestId=1685784741067x977367&messages Supported =1”POST时,此地址中有一个requestId,但不要查看它。您可以自己生成它,或者不更改此链接中的任何内容。除了URL地址中传递的参数外,我们还必须传递“.send(Params)”包中的参数,params看起来是这样的:

Params = "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""username""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & s_username & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""password""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & s_password & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""eventOrigin""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "https://www.efortuna.pl" & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""hr""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "https://www.efortuna.pl/" & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""requestType""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "Login" & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""responseType""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "json" & vbCrLf
     Params = Params & "------WebKitFormBoundaryDVqp4YnVnJBV8KJB--"

从带有“ResponseText”的服务器响应中,我们需要提取3个参数:“userId”“token”“issuerSystemId”将用于下一个查询中的URL和发送包我们还为下一个查询收集cookie
4. POST from address“https://login.efortuna.pl/GetTemporaryAuthenticationToken.php?casinoname=efortuna.pl&serviceType=GamePlay&systemId=“& s_issuerSystemId &“&realMode=1&clientType=sportsbook&clientPlatform=web&clientSkin=efortuna.pl&languageCode=pl&redirectUrl=https:// www . efortuna.pl/#requestId=1685784741320x763605&messagesSupported=1“Params Bundle:

Params = vbNullString
     Params = "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""userId""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & s_userId & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""token""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & s_token & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""username""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & s_username & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""eventOrigin""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "https://www.efortuna.pl" & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""hr""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "https://www.efortuna.pl/" & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""requestType""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "GetTemporaryAuthenticationToken" & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N" & vbCrLf
     Params = Params & "Content-Disposition: form-data; name=""responseType""" & vbCrLf
     Params = Params & vbCrLf
     Params = Params & "json" & vbCrLf
     Params = Params & "------WebKitFormBoundarymokcLayrxADBba8N--"

在这里,我们从答案中提取“sessionToken”,这将是新的登录密码。
5. POST from the address“https://api.efortuna.pl/_login-desktop“这次发送的包很小:Params =“username=”& s_username &“&password=”& s_New_password记住,从responsetext中检索到的sessionToken是我们的“s_New_password”我们坚持到了最后。当然,在每个查询中,我们必须记住适当的“setRequestHeader”头。祝你好运。上述数据截至今日,即02.06.2023,工作并将工作,直到福图纳改变网站上的东西,例如。URL地址。请记住,这不是通过API访问的。

相关问题