import requests
import json
Simple Python implementation of V2.0 REST API
Get started🔗
We’ll use the files from the tse-api-tutorial GitHub repository that you downloaded at the beginning of the tutorial.
-
Open your IDE
Visual Studio Code will be used in all images and instructions. The files for this lesson areapi_training_python_1_begin.py
andapi_training_python_1_end.py
-
Open up your command line or terminal environment as well.
Note
|
There are many ways to install and configure Python on a system. This tutorial shows "plain" versions of all commands as if you are using the main system-wide install of Python for the tutorial. Please adjust all Python commands according to your own environment. |
01 - Imports and variables🔗
At the top of api_training_python_1_begin.py
, there is a set of imports and variables that configure the overall script.
Import Requests library🔗
To issue HTTP commands in a given programming language, you must use a library that sends and receives HTTP.
For this lesson, we’ll use Requests, the most commonly used high-level HTTP library for Python.
The file starts with import commands for the json
standard Python package and the requests
package, which must be installed.