Python Urlopen Error Errno 10054
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies python errno 10054 an existing connection was forcibly closed by the remote host of this site About Us Learn more about Stack Overflow the company errno 10054 python Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges error 10054 an existing connection was forcibly closed by the remote host Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute:
Python Requests An Existing Connection Was Forcibly Closed By The Remote Host
Sign up Python urllib2 and [errno 10054] An existing connection was forcibly closed by the remote host and a few urllib2 problems up vote 4 down vote favorite 1 I've written a crawler that uses urllib2 to fetch urls. every few requests I get some weird behaviors, I've tried analyzing it with wireshark and couldn't understand the problem. getPAGE() is responsible for php errno=10054 an existing connection was forcibly closed by the remote host fetching the url. it returns the content of the url (response.read()) if it successfully fetches the url, else it returns None. def getPAGE(FetchAddress): attempts = 0 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0'} while attempts < 2: req = Request(FetchAddress, None ,headers) try: response = urlopen(req) #fetching the url except HTTPError, e: print 'The server didn\'t do the request.' print 'Error code: ', str(e.code) + " address: " + FetchAddress time.sleep(4) attempts += 1 except URLError, e: print 'Failed to reach the server.' print 'Reason: ', str(e.reason) + " address: " + FetchAddress time.sleep(4) attempts += 1 except Exception, e: print 'Something bad happened in gatPAGE.' print 'Reason: ', str(e.reason) + " address: " + FetchAddress time.sleep(4) attempts += 1 else: return response.read() return None this is the function that calls getPAGE() and checks if the the page I've fetched is valid (checking with - companyID = soup.find('span',id='lblCompanyNumber').string #if companyID is None the page is not valid), if the page is valid it saves the soup object to a global variable named 'curRes'. def isValid(ID): global curRes try: address = urlPath+st
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About connectionreseterror: [winerror 10054] Us Learn more about Stack Overflow the company Business Learn more about hiring developers
Errno 10054 Openssl
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack
An Existing Connection Was Forcibly Closed By The Remote Host Python Socket
Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up python: [Errno 10054] An existing connection was http://stackoverflow.com/questions/6821109/python-urllib2-and-errno-10054-an-existing-connection-was-forcibly-closed-by-t forcibly closed by the remote host up vote 19 down vote favorite 6 I am writing python to crawl Twitter space using Twitter-py. I have set the crawler to sleep for a while (2 seconds) between each request to api.twitter.com. However, after some times of running (around 1), when the Twitter's rate limit not exceeded yet, I got this error. [Errno 10054] An existing connection was http://stackoverflow.com/questions/8814802/python-errno-10054-an-existing-connection-was-forcibly-closed-by-the-remote-h forcibly closed by the remote host. What are possible causes of this problem and how to solve this? I have searched through and found that the Twitter server itself may force to close the connection due to many requests. Thank you very much in advance. python twitter web-crawler share|improve this question edited Apr 14 '14 at 21:11 Kara 3,18473148 asked Jan 11 '12 at 5:54 Nama Keru 113128 add a comment| 2 Answers 2 active oldest votes up vote 7 down vote This can be caused by the two sides of the connection disagreeing over whether the connection timed out or not during a keepalive. (Your code tries to reused the connection just as the server is closing it because it has been idle for too long.) You should basically just retry the operation over a new connection. (I'm surprised your library doesn't do this automatically.) share|improve this answer answered Jan 11 '12 at 5:58 David Schwartz 109k899163 1 I have the same problem. Using bottle library, and sending with httplib. I can't really send retry, because the original call was already executed on server. The connection was closed when I tried to read response data. Thi
»learnpythoncommentsWant to join? Log in or sign up in seconds.|Englishlimit my search to /r/learnpythonuse the following search parameters to narrow your results:subreddit:subredditfind submissions in https://www.reddit.com/r/learnpython/comments/1wqxv8/connection_forcibly_closing_err_10054_in_web/ "subreddit"author:usernamefind submissions by "username"site:example.comfind submissions from "example.com"url:textsearch for "text" in urlselftext:textsearch for "text" in self post contentsself:yes (or self:no)include (or exclude) self postsnsfw:yes (or nsfw:no)include an existing (or exclude) results marked as NSFWe.g. subreddit:aww site:imgur.com dogsee the search faq for details.advanced search: by author, subreddit...this post was submitted on 01 Feb 20140 points (50% upvoted)shortlink: remember an existing connection mereset passwordloginSubmit a new text postlearnpythonsubscribeunsubscribe67,005 readers~99 users here now Welcome to /r/LearnPython! Please read the rules and guidelines below and search before posting. Learning resources All learning resources are in the wiki: /r/learnpython/w/index Frequently Asked Questions: /r/learnpython/w/FAQ IRC Chat Join us in the IRC channel: ##learnpython on irc.freenode.net Webchat link: webchat.freenode.net Guide on how to join and different IRC clients: /wiki/IRC Rules General Rules Posting only assignment/project goal is not allowed. Read posting guidelines. Easily googleable questio