Пример #1
0
import requests
import json
from Get_Token import get_api_token

request = requests.session()

url = "https://sandboxdnac2.cisco.com/dna/intent/api/v1/network-device"
request.headers = {
    'x-auth-token': get_api_token(),
    'Content-Type': 'application/json'
}
request.querystring = {'timestamp': ''}

response = request.get(url, verify=False).json()

for device in response['response']:
    print('*' * 30)
    print("Device: {}".format(device))
    print('*' * 30)
Пример #2
0
import os
from pprint import pprint
from Get_Token import get_api_token
import requests
import json

url = "https://sandboxapicdc.cisco.com/api/class/fabricNode.json"
headers = {"Content-Type": "application/json"}
cookie = {"APIC-cookie": get_api_token()}
payload = {}

api_request = requests.session()
api_request.headers = headers
response = api_request.request(url=url,
                               data=json.dumps(payload),
                               cookies=cookie,
                               method='GET',
                               verify=False).json()
pprint(response)