From caad994f3e675eed0311fdf39d6832b72c121591 Mon Sep 17 00:00:00 2001 From: Tyler Farrelley Date: Mon, 25 Jan 2021 13:18:33 +1100 Subject: [PATCH] Updated to work with https://sandboxdnac.cisco.com --- Python/Networking/DNA/auth.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Python/Networking/DNA/auth.py b/Python/Networking/DNA/auth.py index 14d2499..5e2370c 100644 --- a/Python/Networking/DNA/auth.py +++ b/Python/Networking/DNA/auth.py @@ -1,14 +1,9 @@ import requests import json -base_url = "https://dcloud-dna-center-inst-rtp.cisco.com/dna/" -auth_endpoint = "system/api/v1/auth/token" +auth_response = requests.post('https://sandboxdnac.cisco.com/dna/system/api/v1/auth/token', headers={'Authorization': 'Basic ZGV2bmV0dXNlcjpDaXNjbzEyMyE='}).json() -user = 'demo' -password = 'demo1234!' - -auth_response = requests.post( - url=f"{base_url}{auth_endpoint}", auth=(user, password)).json() +print (auth_response) token = auth_response['Token'] @@ -18,4 +13,4 @@ "Content-Type": "application/json" } -print(token) +print(token) \ No newline at end of file