-
Notifications
You must be signed in to change notification settings - Fork 0
/
axl_config.py
executable file
·30 lines (24 loc) · 1.05 KB
/
axl_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# axl_config.py
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep import Client, Settings, Plugin, xsd
from zeep.transports import Transport
import urllib3
# AXL settings and configurations
class AXLConfig:
binding_name = "{http://www.cisco.com/AXLAPIService/}AXLAPIBinding"
axl_address = "https://<IP or hostname>/axl/"
wsdl_file = "~/schema/AXLAPI.wsdl"
def __init__(self, username, password):
self.username = username
self.password = password
# Set up session and transport configurations
session = Session()
session.verify = False
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
session.auth = HTTPBasicAuth(username, password)
transport = Transport(session=session, timeout=5)
settings = Settings(strict=False, xml_huge_tree=True)
self.client = Client(wsdl=self.wsdl_file, transport=transport, settings=settings)
def create_service(self):
return self.client.create_service(self.binding_name, self.axl_address)