Comments (3)
@dirtyluke 贴一下你的报错信息,看能不能尽量详细一些
from pythonpractice.
不好意思现在才回复。。。
74339197:html parse error in getUserData
Traceback (most recent call last):
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 1314, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "D:\Program Files\Python\Python36\lib\http\client.py", line 1155, in request
self._send_request(method, url, body, headers)
File "D:\Program Files\Python\Python36\lib\http\client.py", line 1200, in _send_request
self.endheaders(body)
File "D:\Program Files\Python\Python36\lib\http\client.py", line 1151, in endheaders
self._send_output(message_body)
File "D:\Program Files\Python\Python36\lib\http\client.py", line 983, in _send_output
self.send(msg)
File "D:\Program Files\Python\Python36\lib\http\client.py", line 926, in send
self.connect()
File "D:\Program Files\Python\Python36\lib\http\client.py", line 898, in connect
(self.host,self.port), self.timeout, self.source_address)
File "D:\Program Files\Python\Python36\lib\socket.py", line 711, in create_connection
raise err
File "D:\Program Files\Python\Python36\lib\socket.py", line 702, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "huajiao.py", line 218, in
main(sys.argv)
File "huajiao.py", line 196, in main
spiderUserDatas()
File "huajiao.py", line 130, in spiderUserDatas
userId = getUserId(liveId)
File "huajiao.py", line 29, in getUserId
html = urlopen("http://www.huajiao.com/l/" + str(liveId),timeout=1)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 526, in open
response = self._open(req, data)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 544, in _open
'_open', req)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 1342, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "D:\Program Files\Python\Python36\lib\urllib\request.py", line 1316, in do_open
raise URLError(err)
urllib.error.URLError:
from pythonpractice.
解决了,自己前面设置的超时设置太长了,网上说的是可能服务器自动断开了连接,但客户端不知道,才产生的错误,把超时时间缩短就能捕获了
from pythonpractice.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonpractice.