in libs/duo/__init__.py [0:0]
def _create_duo_client(self):
"""
Creates a DUO Admin API Client object.
:return: DUO client object
"""
if self.config["ca_certs"] == "":
client = duo_client.Admin(ikey=self.config["ikey"],
skey=self.config["skey"],
host=self.config["host"])
else:
client = duo_client.Admin(ikey=self.config["ikey"],
skey=self.config["skey"],
host=self.config["host"],
ca_certs=self.config["ca_certs"])
if self.use_proxy is True:
self.proxy_headers = {"Proxy-Authorization": "Basic " + base64.b64encode(b"%s:%s" % (
self.proxy_config["proxy_user"],
self.proxy_config["proxy_pass"])).decode("utf-8")}
client.set_proxy(host=self.proxy_config["proxy_url"],
port=self.proxy_config["proxy_port"],
headers=self.proxy_headers,
proxy_type="CONNECT")
return client