先导入函数库
from copyheaders import headers_raw_to_dict
然后复制请求头
headers = b'''accept: application/json, text/plain, */* accept-encoding: gzip, deflate, br accept-language: zh-CN,zh;q=0.9,eu;q=0.8 cache-control: no-cache cookie: USER_UNI=3c0c90739ef109ba79f2d57df776446; USID=3d389e70493669f1e51915c543b22917; WSTK=353c8ee8bffb0b5cbed88b6b6c4fab0a; UM_distinctid=166a9e502b8c70-0a5210ffcbb05b-8383268-1fa400-166a9e502b9acb; CNZZDATA1264632762=1173541806-1540447401-%7C1540447401; reurl=%2Ftrade%2Fbtc_dob; _ga=GA1.2.838378757.1540448662; _gid=GA1.2.1695687236.1540448662 pragma: no-cache referer: https://www.dobitrade.com/trade/btc_dob user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'''
在请求的时候进行转换
response = requests.get(url, headers=headers_raw_to_dict(headers), proxies=proxies)