Please let me know what's wrong with this. I don't see it.
The code is as follows: Is there any problem with the writing method?
import requests
base_url = 'https://xueqiu.com/hq#exchang...';
headers = {'user_agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML , like Gecko) Chrome/53.0.2785.89 Safari/537.36'}
req = requests.request(method='get',url=base_url,headers=headers)
rsp = requests.get(req)
Your
req
没有符合url的格式, 看到报错,req
的结果是http://<Request[403]>
刚才去看了
requests
的模块定义, 觉得requests.request
has already initiated a visitThere seems to be something wrong with the way user_agent in the header is written. It should be written the same way as the browser
request.get