Python机械化脚本无法登录特定页面

时间:2013-11-15 22:54:13

标签: python mechanize

我想在获取我想要的信息之前使用Python登录网站。以下代码可以登录,并且可以正常使用某些网页:

import urllib2
from bs4 import BeautifulSoup
import mechanize

b = mechanize.Browser()
r = b.open("https://www.artofproblemsolving.com/Forum/ucp.php?mode=login&redirect=/index.php")
b.select_form(nr=1) 

b.form["username"] = "username"
b.form["password"] = "password"
b.submit()

question_page = "http://www.artofproblemsolving.com/Forum/memberlist.php"
into_question_page = urllib2.urlopen(question_page)
read_question_page = into_question_page.read()

print read_question_page

但不适用于此页面:

http://www.artofproblemsolving.com/Forum/memberlist.php

此页面是否特殊,需要使用其他工具吗?

0 个答案:

没有答案