04-07 接口请求构造

机智的测试生活

get query 请求

params_query = {
"key1": "value1",
"key2": "value2"
}

r = requests.get(url, params=params_query)

form 请求

params_form = {
"key1": "value1",
"key2": "value2"
}

r = requests.post(url, data=params_form)

文件上传

files = {
"file": open("file_path", "rb")
}

r = requests.post(url, files=files)

header

headers = {
"user-agent": "agent"
}

r = requests.get(url, headers=headers)

cookie

cookies = {
"cookies": "value"
}

r = requests.get(url, cookies=cookies)
阅读 430

机智的测试生活
双非大龄青年,转行测试工程师。 分享测试工程师的职业经验, 提供付费转行咨询

公号|机智的测试生活

75 声望
476 粉丝
0 条评论

公号|机智的测试生活

75 声望
476 粉丝
文章目录
宣传栏