First, install the necessary tools
install python3 Above version :
Download from the official website :https://www.python.org/getit/
install pycharm Tools :
Download from the official website :https://www.jetbrains.com/pycharm/
install requests Library for sending http request :
pip install requests
ordinary GET Request :
# Import requests library
import requests
# send out get request , visit http://www.baidu.com
res = requests.get("http://www.baidu.com")
# Print back the body
print(res.text)ordinary post request :
import requests
data = {
"username":"admin",
"password":"123456"
}
res = requests.post(url = "http://localhost:8080/login",json=data)
print(res.text)
At the top of the res For one response object , We can get the return information we want from this object for assertion