发送时指定 Query 参数: {
"args": {
"user-id": "u-001"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f09-083cd24569089d0b24dc78b8"
},
"origin": "101.132.183.69",
"url": "https://httpbin.org/get?user-id=u-001"
}
发送时指定请求头: {
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f0a-5cbb1a1a0f1dc8b46d648575",
"X-User-Id": "u-001"
},
"origin": "101.132.183.69",
"url": "https://httpbin.org/get"
}
发送时指定超时时间: {
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f0a-6c6cf1b94cc4c1144faa7054"
},
"origin": "101.132.183.69",
"url": "https://httpbin.org/get"
}
/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py:842: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn((
发送时忽略 HTTPS 证书验证(请求自签名域名时使用): {
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f0b-632853b91c5290d55f49bef4"
},
"origin": "101.132.183.69",
"url": "https://httpbin.org/get"
}
发送 POST 请求,请求体为 Form 格式: {
"args": {},
"data": "",
"files": {},
"form": {
"key": "value"
},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "9",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f0c-4e725597001f988434096767"
},
"json": null,
"origin": "101.132.183.69",
"url": "https://httpbin.org/post"
}
发送 POST 请求,请求体为 JSON 格式: {
"args": {},
"data": "{\"key\": \"value\"}",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "16",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.28.1",
"X-Amzn-Trace-Id": "Root=1-63118f0d-66486dcd4c6889b61d4249c9"
},
"json": {
"key": "value"
},
"origin": "101.132.183.69",
"url": "https://httpbin.org/post"
}