更好地处理原始数据的库
http-raw的Python项目详细描述
http原始
更好地处理原始数据的库
安装
pip install http-raw
使用
importhttprawraw='''POST /post HTTP/1.1Host: httpbin.orgUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencodedContent-Length: 19key1=val1&key2=val2'''# resp is requests Responseresp=httpraw.request(raw=raw)print(resp.status_code)print(resp.text)proxy={'socks5':'127.0.0.1:1086'}resp=httpraw.request(raw=raw,proxy=proxy,timeout=5,ssl=True,verify=True)# use apiurl='http://httpbin.org/post'headers='''User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateConnection: closeContent-Type: application/x-www-form-urlencoded'''data='key1=val1&key2=val2'resp=httpraw.post(url,headers=headers,data=data)
开发
pipenv install --dev