From the course: Cisco DevNet Associate (200-901) Cert Prep 2: Understanding and Using APIs

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Python standard library and frameworks

Python standard library and frameworks

From the course: Cisco DevNet Associate (200-901) Cert Prep 2: Understanding and Using APIs

Start my 1-month free trial

Python standard library and frameworks

- [Instructor] Let's begin by install the requests library. Python uses this package management system, called pip. We will install the package by using pip install, and the package name, which is requests. Let me clear my screen. Now that the requests library is installed, let's take a look at the script. As you could see, we will use the requests library by using the import statement in line three. In line four, we will also import the json library, which is part of the standard library. In line six, we have the url as 172.16.1.90. This is the same device that we saw in Section One, where we used the text-based tool, such as Curl and http.py, to make api requests. The user uses the local authentication, which is cisco, and cisco, indicated in lines seven and eight. In line 10, we'll use the content-type for application/json-rpc. Remember, because we're using json-rpc, we need to include the method, which is indicated in…

Contents