简体   繁体   English

TimeoutError: [WinError 10060] 连接尝试失败

[英]TimeoutError: [WinError 10060] A connection attempt failed

TimeoutError: [WinError 10060] 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 TimeoutError: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者因为连接的主机没有响应而建立连接失败

I did everything I can think of to fix this but maybe im not fully understanding this error.我做了我能想到的一切来解决这个问题,但也许我没有完全理解这个错误。 Please help me out.请帮帮我。

Here is the code and link.这是代码和链接。

import urllib.request
import requests

link = "https://www1.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=242&symbol=RELIANCE&symbol=RELIANCE&instrument=OPTSTK&date=-segmentLink=17&segmentLink=17"


user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
request = urllib.request.Request(link,headers={'User-Agent': user_agent})
response = urllib.request.urlopen(request)
html = response.read()
print(html)

Use selenium instead:改用selenium

from selenium import webdriver
import os

browser = webdriver.Chrome(executable_path=os.path.abspath(os.getcwd()) + "/chromedriver")
link = "https://www1.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=242&symbol=RELIANCE&symbol=RELIANCE&instrument=OPTSTK&date=-&segmentLink=17&segmentLink=17"
browser.get(link)
context = browser.page_source

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TimeoutError:[WinError 10060] 连接尝试失败:除了块也不执行 - TimeoutError: [WinError 10060] A connection attempt failed : Except block doesn't execute either TimeoutError: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应或### - TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time or### 超时错误:[WinError 10060]: - TimeoutError: [WinError 10060] : 通过Django发送电子邮件 - WinError 10060连接尝试失败,GetAddrInfo错误 - Sending Emails through Django - WinError 10060 A connection attempt failed and GetAddrInfo Error Jupyter Notebook:[WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应 - Jupyter Notebook: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time Python 套接字在其他计算机上超时。 超时错误:[WinError 10060] - Python socket timing out on other computer. TimeoutError: [WinError 10060] Python-requests [('连接中止。', TimeoutError(10060) ] - Python-requests [('Connection aborted.', TimeoutError(10060) ] 解析学校网站时出现TimeoutError:[WinError 10060] - I get TimeoutError: [WinError 10060] when I parsing my school website Python中的套接字编程引发错误socket.error:&lt;[Errno 10060]连接尝试失败 - Socket Programming in Python raising error socket.error:< [Errno 10060] A connection attempt failed Python ftplib WinError 10060 - Python ftplib WinError 10060
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM