需要携带请求头的请求,必须要携带,每个请求的请求头不一样 自己指定好 加入到请求参数中即可
# 这里没有请求头,特别需求需要携带
headers={
"User-Agent": "PostmanRuntime/7.15.2",
"Postman-Token": "2feef698-3a31-442f-849d-83b0ec10f13c",
"content-type": "application/x-www-form-urlencoded"
}
response = requests.request(get, url, data=sysinfo, headers=headers)
GET 获取接口数据
import requests
url = "http://127.0.0.1:8000/Host/"
tmp_data = requests.request("get", url)
# 序列化数据
req_dict = tmp_data.json()
POST 向接口提交数据
import requests
url = "http://127.0.0.1:8000/Host/"
data = {
"name": "sirliu",
"age": "18",
"height": "190"
}
response = requests.request("post", url, data=data)
print(response.text)
PUT 更新接口数据
import requests
url = "http://127.0.0.1:8000/Host/"
data = {
"name": "sirliu",
"age": "19",
"height": "210"
}
response = requests.request("put", url, data=data)
# 成功后到返回值,text / json 展示都可以
print(response.text)
最新评论
# 这只是一个创建远程登录并授权的语句、仅作为记录 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Fit2cloud!' WITH GRANT OPTION;
当MGR集群初始化结束后,需要开启MGR集群自启动(需要有一台节点是自动开启引导) loose-group_replication_start_on_boot = ON #设置节点是否在启动时自动启动 MGR 集群 loose-group_replication_bootstrap_group = ON #设置节点是否作为初始引导节点启动集群
密码:blog.sirliu.com
本内容密码:blog.sirliu.com 最新整理的文章在这里喔:https://blog.sirliu.com/2018/11/shell_lian_xi_ti.html