def setProxy(self, proxy):
profile = FirefoxProfile()
profile.accept_untrusted_certs = True
profile.assume_untrusted_cert_issuer = True
prefix = "network.proxy."
profile.set_preference("%stype" % prefix, 1)
for type in ["http", "ssl", "ftp", "socks"]:
profile.set_preference("%s%s" % (prefix, type), proxy.getHost())
profile.set_preference("%s%s_port" % (prefix, type), int(proxy.getPort()))
return profile
评论列表
文章目录