fastapi中的request对象,包含很多交互需要的数据,尤其是scope属性:
'type': 'http'请求类型
'http_version': '1.1'版本号
'server': ('127.0.0.1', 8000)服务器ip地址及端口
, 'client': ('127.0.0.1', 3385)客户端ip地址及端口
'method': 'GET'使用get还是post
'path': '/index'请求路径
'session': {'captcha': 'CBGKST', 'token': '11', 'user': 'admin'}这个就不说了
还有个重量级的headers是个列表:
(b'host', b'127.0.0.1:8000')
(b'connection', b'keep-alive')
(b'cache-control', b'max-age=0')
(b'sec-ch-ua', b'"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"')
(b'sec-ch-ua-mobile', b'?0')
(b'sec-ch-ua-platform', b'"Windows"')
(b'upgrade-insecure-requests', b'1')
(b'user-agent', b'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36')
(b'accept', b'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'), (b'sec-fetch-site', b'same-origin'), (b'sec-fetch-mode', b'navigate'), (b'sec-fetch-user', b'?1'), (b'sec-fetch-dest', b'document'), (b'referer', b'http://127.0.0.1:8000/'), (b'accept-encoding', b'gzip, deflate, br'), (b'accept-language', b'zh-CN,zh;q=0.9')
(b'cookie', b'session=eyJjYXB0Y2hhIjogIkNCR0tTVCIsICJ0b2tlbiI6ICJleUpoYkdjaU9pSklVekkxTmlJc0luUjVjQ0k2SWtwWFZDSjkuZXlKbGVIQWlPakUyTmpVMU16WTFOalVzSW5OMVlpSTZJbUZrYldsdUluMC51NU1jdTByU0VqNUY3RnhtWVBfSzdUTC13UFJIRFJlSDlMTFBRZFJZV2pJIiwgInVzZXIiOiAiYWRtaW4ifQ==.Y0YRCQ.EihV75xRzi0i57R9WgxmPxsV6Kg')