Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions Python/Networking/DNA/auth.py
Original file line numberDiff line numberDiff line change
@@ -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']

Expand All@@ -18,4 +13,4 @@
"Content-Type": "application/json"
}

print(token)
print(token)