diff --git a/.gitignore b/.gitignore index f24fc58..3660b77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode +.DS_Store # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/panw_utils/get_panw_firewalls.py b/panw_utils/get_panw_firewalls.py index 2ad433d..cee4c29 100755 --- a/panw_utils/get_panw_firewalls.py +++ b/panw_utils/get_panw_firewalls.py @@ -29,9 +29,11 @@ import signal import ssl import sys -import urllib.request import xml.dom.minidom as MD import xml.etree.ElementTree as ET +from urllib import parse +from urllib.request import urlopen + def sigint_handler(signum, frame): sys.exit(1) @@ -47,14 +49,14 @@ def query_api(args): cmd = '' else: cmd = '' - params = urllib.parse.urlencode({ + params = parse.urlencode({ 'type': 'op', 'cmd': cmd, 'key': args.key, }) url = f'https://{args.panorama}/api/?{params}' try: - with urllib.request.urlopen(url, context=ctx) as response: + with urlopen(url, context=ctx) as response: xml = response.read().decode('utf-8') except OSError as err: sys.stderr.write(f'{args.panorama}: Unable to connect to host ({err})\n')