报错:
G:\python27\python.exe D:/编程/PY/test_new.py
Traceback (most recent call last):
File "D:/���/PY/test_new.py", line 9, in
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验证试试看