300-610 · Question #179
An engineer must develop a Python tool to automate software upgrades of both data center and non-data center devices. All devices offer a RESTful API and require a JSON or XML payload Vendor-specific
The correct answer is A. requests. To develop a Python tool for automating software upgrades on data center and non-data center devices via RESTful APIs with JSON or XML payloads, while avoiding vendor-specific libraries, the requests library is the appropriate choice.
Question
An engineer must develop a Python tool to automate software upgrades of both data center and non-data center devices. All devices offer a RESTful API and require a JSON or XML payload Vendor-specific libraries must be avoided. Which library must the engineer choose?
Options
- Arequests
- BNornir
- Cncciient
- DNetmiko
How the community answered
(17 responses)- A88% (15)
- B6% (1)
- C6% (1)
Why each option
To develop a Python tool for automating software upgrades on data center and non-data center devices via RESTful APIs with JSON or XML payloads, while avoiding vendor-specific libraries, the `requests` library is the appropriate choice.
The `requests` library is a widely used and robust HTTP library for Python that simplifies making HTTP requests, which is essential for interacting with RESTful APIs. It natively supports sending and receiving JSON or XML payloads and is completely vendor-agnostic, making it perfectly suited for automating software upgrades across diverse network devices that offer RESTful interfaces without using vendor-specific code.
Nornir is an automation framework written in Python that often leverages other libraries for device interaction (e.g., Netmiko for CLI), and while extensible for REST APIs, it is not the primary library for direct RESTful API calls and may still depend on other modules for specific interactions.
`ncclient` is a Python library specifically designed for NETCONF clients, which communicate using XML-based messages, but it is not a general-purpose library for arbitrary RESTful APIs that can handle both JSON and XML.
Netmiko is a Python library used for connecting to network devices via SSH and sending CLI commands, making it suitable for CLI automation but not for interacting with devices via RESTful APIs that require JSON or XML payloads.
Concept tested: Python REST API interaction, network automation libraries
Source: https://docs.python-requests.org/en/latest/
Topics
Community Discussion
No community discussion yet for this question.