import json import requests # # disable certificate warnings from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # supports HTTPS warnings hostname = 'ise.securitydemo.net' username = 'admin' password = 'C1sco12345' resource = 'internaluser' url = f'https://{hostname}:9060/ers/config/{resource}' response = requests.get(url, auth=(username, password), headers={ 'Accept': 'application/json', 'Content-Type': 'application/json' }, verify=False ) # Show request headers print(f'-'*80) sorted_headers = sorted(response.request.headers.items()) for key,value in sorted_headers : print(f'{key}:[{value}]') # Show response headers print(f'-'*80) sorted_headers = sorted(response.headers.items()) for key,value in sorted_headers : print(f'{key}:[{value}]') # Dump JSON print(f'-'*80) print(json.dumps(response.json(), indent=2))