import requests
# def http_requsts():
# login_url = "http://www.tuling123.com/openapi/api"
# data = {
# "key": "ec961279f453459b9248f0aeb6600bbe",
# "info": "你好"
# } # 字典格式,单独提出来,方便参数的添加修改等操作
# res= requests.get(login_url, data)
# print("get请求text的响应报文",res.text)
# print("get请求的请求头",res.headers)
# print("get请求的状态码",res.status_code)
# print("get请求的json格式报文",res.json())
# http_requsts()
login_url = "http://www.tuling123.com/openapi/api"
data = {
"key": "ec961279f453459b9248f0aeb6600bbe",
"info": "你好"
} # 字典格式,单独提出来,方便参数的添加修改等操作
res = requests.post(login_url, data)
print("post请求的json格式报文",res.json())
# print("post请求text的响应报文",res.text)
# print("post请求的请求头",res.headers)
# print("post请求的状态码",res.status_code)
# print("post请求的json格式报文",res.json())
原文:https://www.cnblogs.com/zhang-ping1205/p/12943847.html