安装
pip install requests
请求
import requests
#GET
res = requests.get("http://10.0.20.22:9999/actuator/health")
print(res.text)
#POST
url = "api地址"
jsonParam = {
"pageIndex":1,
"pageSize":10
}
headers={
"Authorization":"MDNlNTQwMjNhOGFmNzdjNjRlYzhiNDY0MDViMjEwYzU="
}
res = requests.post(
url=url,
json=jsonParam,
headers=headers
)
print(res.text)