python爬虫之hearder验证缺失

来源:互联网 发布:cad数据恢复 编辑:程序博客网 时间:2024/05/16 01:12
报错:
G:\python27\python.exe D:/编程/PY/test_new.py
Traceback (most recent call last):
  File "D:/���/PY/test_new.py", line 9, in <module>
    response = urllib2.urlopen(request)
  File "G:\python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "G:\python27\lib\urllib2.py", line 400, in open
    response = self._open(req, data)
  File "G:\python27\lib\urllib2.py", line 418, in _open
    '_open', req)
  File "G:\python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "G:\python27\lib\urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "G:\python27\lib\urllib2.py", line 1180, in do_open
    r = h.getresponse(buffering=True)
  File "G:\python27\lib\httplib.py", line 1030, in getresponse
    response.begin()
  File "G:\python27\lib\httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "G:\python27\lib\httplib.py", line 371, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''

Process finished with exit code 1

尝试解决方法:
加上一个headers验证试试看

0 0
原创粉丝点击