When we are crawling some sites using python, we get WinError 10060 error. In this tutorial, we will introduce this error and disucss how to fix it.
WinError 10060
If you are using python 3 to crawl sites, you may get this error.
The reason is: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
How to fix WinError 10060?
There are some methods to fix this error.
1. Increase connect time
If your network is not good, it will take a long time to connect a host, in that case, you should increase the connect time of your application.
Best Practice to Set Timeout for Python urllib.request.urlretrieve() – Python Web Crawler Tutorial
2. Improve your network
If the speed of your network is not good, it is hard to connect servers. In that case, you should improve your network.
3. Make sure your compter run few applications
If your computer are running many applications, these applications will decrease the performance of processing network. In that situation, you can close some applications or restart your computer.
4. Check the performance of destination server
If the performace of destination server is not good, you connet it, it will take a long time to response to you, then WinError 10060 will occur. As to this situation, we can not do anything.