def __init__(self, username="admin", password="admin", hostname="192.168.1.1"):
self.username = username
self.password = password
self.hostname = hostname
self.baseurl = "https://" + self.hostname
try:
self.gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
except AttributeError:
try:
self.gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1_1)
except AttributeError:
self.gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
self.cj = CookieJar()
self.opener = build_opener(HTTPCookieProcessor(self.cj), HTTPSHandler(context=self.gcontext))
self.loginresponse = self._login()
评论列表
文章目录