小编Ale*_*ith的帖子

python urllib中的复选框输入

如果 HTML 代码如下所示,如何检查复选框:

<input type="checkbox" name="tos_understood" style="background:none; border:none" />
Run Code Online (Sandbox Code Playgroud)

所以,我的python代码是:

import urllib
import urllib2
import cookielib

authentication_url = 'http://test.com'

# Input parameters we are going to send
payload = {
  'user': 'newuser',
  'pass': '12345'
  'tos_understood': ??????????
  }

# Use urllib to encode the payload
data = urllib.urlencode(payload)

# Build our Request object
req = urllib2.Request(authentication_url, data)
print req

# Make the request and read the response
resp = urllib2.urlopen(req)
contents = resp.read()
print contents
Run Code Online (Sandbox Code Playgroud)

我应该在 tos_understood 部分写什么?没有选中复选框就无法登录。

python urllib urllib2 python-2.7

5
推荐指数
1
解决办法
4946
查看次数

标签 统计

python ×1

python-2.7 ×1

urllib ×1

urllib2 ×1