In this worked example, we will produce the same CSV file output as in the first PowerShell worked example.
The "requests" module in Python handles web requests very nicely. If this is not installed on your system you can install it as follows:
On Linux or macOS:
pip install -U pip requests |
On Windows:
python -m pip install -U pip requests |
The RestAPI uses HTML basic authentication - for this example we will use the default user name of admin and a password of password. In a production environment you should always change the default credentials.
The requests module handles the HTTP details for us.
import requests r = requests.get('http://vm-mike-2012b/api/v1/devices',auth=('admin','password')) max = r.headers['X-fetch-count'] data = r.json() count = len(data) |
You may also want to use visual panels to communicate related information, tips or things users need to be aware of. |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|