import requests
import json
#get
url1="http://localhost:5045/Health/Hi"
res = requests.get(url=url1)
print(res.text)
#post
url2="http://localhost:5045/Health/GetProfile"
textmod = {'Id':'1'}
res = requests.post(url2,data=json.dumps(textmod), headers={'content-type': 'application/json;charset=UTF-8'})
print(res.text)
Python调用WebAPI
最新推荐文章于 2024-09-18 22:07:25 发布