-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Python Network Programming Techniques
By :
As we have seen, the HTTP protocol is a plain text protocol, and while we could implement this protocol by hand, that is very cumbersome. We will thus use the requests module. This module abstracts the process of requesting and handling the response from an HTTP server. In this first recipe, we will see how to do an initial request against a network device that has RESTCONF enabled. This recipe thus also serves as a verification that RESTCONF is properly enabled on your device.
Open your code editor and start by creating a file called make_request.py. Next, navigate in your terminal to the same directory in which you just created the make_request.py file.
Follow these steps to make your first HTTP request using Python and the requests module:
requests module:import requests
requests session:s = requests.Session()