def __init__(self, ipaddress, username = 'admin', password = ''):
self.address = ipaddress
self.username = username
self.password = password
pwd_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
pwd_mgr.add_password(None, 'http://{}'.format(self.address), self.username, self.password)
handler = urllib2.HTTPBasicAuthHandler(pwd_mgr)
self.conn = urllib2.build_opener(handler)
self._url_snapshot = 'http://{address}/snapshot.cgi'.format(address = self.address)
self._url_command = 'http://{address}/decoder_control.cgi?username={username}&password={password}&command='.format(address = self.address, username = self.username, password = self.password) + '{command}'
评论列表
文章目录