I wrote a script that, using a loop, constantly parses the site, getting new data from it. After a while, the loop produces the following error:

urllib.error.URLError: <urlopen error [WinError 10060] Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера> 
  • 2
    This is normal; add error handling to the code - andreymal pm
  • Python: URLError: <urlopen error [Errno 10060] stackoverflow.com/questions/15820739/… - S. Nick
  • Site owners usually do not want their parsili. Therefore, many sites have protection and blocking parsers as soon as they are noticed. - Sergey Gornostaev

1 answer 1

The site most likely simply rejects the request. If this is true so that this does not happen, you can:

  1. increase the timeout between requests
  2. for each request, use the new User-Agent (search the Internet for lists of user agents, or use the fake_useragent library - https://pypi.org/project/fake-useragent/ )
  3. use proxy

Best of all, combine a few items.