Chinaunix

标题: response.status_code404但是浏览器能打开 [打印本页]

作者: xinshou6    时间: 2020-07-19 10:51
标题: response.status_code404但是浏览器能打开
本帖最后由 xinshou6 于 2020-07-19 20:39 编辑

for i in neirong:
    headers = {
                     'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
                     'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                     'Connection':'keep-alive',
                     'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3'
              }
    requests.packages.urllib3.disable_warnings()
    response = requests.get(i,headers = headers,proxies=None,verify=False)
    if response.status_code == 200:

url类似这种https://cloud.tencent.com/developer/article/1662426 有的200有的404, 加了sleep一样 请问怎么改?如果直接在i写单个url可以,就是connectionpool.py:794: InsecureRequestWarning。看网上加了Referer之后一个也打不开了;-----听网友的print出来 前后加点符号,发现有回车。改了就好了。开始改成i='',requests.exceptions.InvalidSchema: No connection adapters were found for ''httpsxx'',把引号去了就好了。注意要有http。./222 --load-error-handling ignore  'h。。。'  wei/ming.pdf 网址带' 名字不能有空格 wkhtmltopdf.exe改了名不然不会用------error writing 'standard output': Input/output error 用cat head错误,more less可以 ,grep file 提示Binary file quan.txt matches  复制粘贴到txt中可以正常看了。






欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2