Postman comes with its own script export function. For code beginners, it can be a good way to learn code-level interface testing.
Step 1: Enter the interface address and click send
Step 2: Click code to export the script file as a python script
The third step: install python3 and use pip to install the requests library, not much introduction here
Step 4: Run the test script
Step 5: Supplement
We see that the above script has no assertions, so it cannot be called a test case, but a test script. It is recommended to learn the unittest unit testing framework of python. After learning, you can use the script to write test cases smoothly.