本文整理汇总了Python中mechanize.Browser.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Browser.__init__方法的具体用法?Python Browser.__init__怎么用?Python Browser.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mechanize.Browser
的用法示例。
在下文中一共展示了Browser.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self):
Browser.__init__(self)
self.set_handle_robots(False)
self.addheaders = [(
'Accept',
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
)]
示例2: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self._clone_actions = {}
sc = kwargs.pop('ssl_context', None)
if sc is None:
sc = ssl.create_default_context() if kwargs.pop('verify_ssl', True) else ssl._create_unverified_context(cert_reqs=ssl.CERT_NONE)
B.__init__(self, *args, **kwargs)
self.set_cookiejar(CookieJar())
self._ua_handlers['https'].ssl_context = sc
示例3: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self,
factory=None,
history=None,
request_class=None,
):
Browser.__init__(self, factory, history, request_class)
self.delay = 2
self.addheaders = [('User-agent',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7')]
示例4: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self):
Browser.__init__(self)
self.set_handle_redirect(True)
self.set_handle_referer(True)
self.set_handle_equiv(True)
self.set_handle_robots(False)
self.set_handle_referer(False)
self.set_handle_refresh(HTTPRefererProcessor(),max_time=1)
self.cookiejar = CookieJar()
self.set_cookiejar(self.cookiejar)
示例5: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self,searchString):
Browser.__init__(self)
self.set_handle_robots(False)
while True:
try:
self.r=self.open("https://e91.absa.co.za/esl/locatorResult.do?Quicksearch=true&Invalid=true&Token=%s" % searchString).read()
except URLError:
randomsleep(80)
pass
else:
break
self.x=fromstring(self.r)
示例6: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self._clone_actions = {}
B.__init__(self, *args, **kwargs)
self.set_cookiejar(CookieJar())
示例7: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self,auto_open=True):
Browser.__init__(self)
if auto_open:
r=self.open('http://coachusa.com/coachss-v2/index.asp?action=GetSetOriginState')
self.__setxml(r)
示例8: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self, url):
Browser.__init__(self)
self.addheaders = [('User-agent', 'Firefox')]
self._url = url
return
示例9: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self):
Browser.__init__(self)
self.addheaders=[("User-agent","Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7")]
self._factory.is_html=True
示例10: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self):
self._clone_actions = {}
B.__init__(self)
self.set_cookiejar(CookieJar())
示例11: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self, default_encoding="latin-1"):
Browser.__init__(self)
self.last_call_latency = 0
Browser.set_debug_responses(self, True)
Browser.set_debug_redirects(self, True)
示例12: __init__
# 需要导入模块: from mechanize import Browser [as 别名]
# 或者: from mechanize.Browser import __init__ [as 别名]
def __init__(self, *args, **kwargs):
# install WSGI intercept handler.
install(self)
MechanizeBrowser.__init__(self, *args, **kwargs)