Practice – Cisco DNAC Python

Logged in as

Fill in the missing parts of this DNAC Python function that creates a site.

Drag the correct code snippets from the options panel into the placeholders in the code window.

python import {{1}} # Webex Teams API base URL and authentication token base_url = 'https://api.ciscospark.com/v1' auth_token = 'your_auth_token' # Function to send a message to a Webex Teams room def send_message(room_id, message): headers = { 'Authorization': f'Bearer {auth_token}', 'Content-Type': 'application/json' } data = { 'roomId': {{2}}, 'text': message } response = requests.post(f'{base_url}/messages', headers=headers, json=data) if response.status_code == 200: print("Message sent successfully.") else: print("Failed to send message. Status code:", response.status_code) # Example usage of send_message function room_id = 'your_room_id' message_text = 'Hello from ChatOps!' send_message(room_id, message_text)

Drag a snippet from the right into each blank box in the code.

Available snippets

requests
room_id
"Site created successfully"
404