登录到需要用python编写javascript的网站

2024-03-29 14:40:59 发布

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

我正在尝试登录此网站/browsergameTravian login。我已经搜索了一段时间,尝试了不同的模块,但到目前为止我还没有成功。。。你知道吗

import requests

# Fill in your details here to be posted to the login form.
payload = {
'name': 'username',
'password': 'password'
}

# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
p = s.post('http://ts8.travian.com/dorf1.php', data=payload)
# print the html returned or something more intelligent to see if it's a     successful login page.
print(p.text)

# An authorised request.
r = s.get('http://ts8.travian.com/statistiken.php')
print(r.text)
    # etc...

当它打印出r.text时,html代码看起来好像失败了。。有人知道我做错了什么吗?你知道吗


Tags: thetotextcomhttphtmlwithlogin
1条回答
网友
1楼 · 发布于 2024-03-29 14:40:59

你没有发送他们期望的所有正确参数。他们期望的不仅仅是用户/通行证。你知道吗

下面是我在Delphi中使用的params的一些代码

  PostData.Add('name='+Username);
  PostData.Add('password='+Password);
  PostData.Add('s1='+'login');
  PostData.Add('w='+'1440:900'); //mod'd for example 
  PostData.Add('login='+'1398184793'); // mod'd for example

相关问题 更多 >