Question 20 of 32


Prev Question Next Question

Question

def query(config, secret, url, payload):
print (‘query url=' + url)
print(' request=' + payload)
handler = urllib.request .HTTPSHandler (context=config.get_ssl_context ())
opener = urllib.request.build_opener (handler)
rest_request = urllib.request.Request (url=url, data=str.encode (payload) )
rest_request.add_header('Content-Type', 'application/json')

rest_request.add_header('Accept', ‘application/json')

b64 = baseé4.b64encode ( (config.get_node_name() + ':' + secret) .encode()) «decode ()
rest_request.add_header('Authorization', ‘Basic ' + b64)

rest_response = opener.open(rest_request)

print(' response status=' + str(rest_response.getcode()))

print(' response content=" + rest_response.read() .decode ())

Refer to the exhibit.

A Python function named "query" has been developed and the goal is to use it to query the service "com.cisco.ise.session" via Cisco pxGrid 2.0 APIs.

How is the function called, if the goal is to identify the sessions that are associated with the IP address 10.0.0.50?

Answers