title: How to solve the 10054 error
body: <p>I'm using an app provided by some website to collect some data from the website periodly, say, 30s a time.
  The returned response is then recorded in database.</p>
  
  <p>I use the requests modular by import requests and write codes to catch Exception.
  The codes for the main function are as following:</p>
  
  <pre><code>def get_response(self):
      try:
         response = requests.get(self.request_url)
         if response.status_code == 200:
            return response.json()
         except Exception as e:
            msg = "Exception is:\n %s \n" % e
            print msg
  </code></pre>
  
  <p>The above function works quite well for the first several hours.
  The function can also recover from some exceptions like:
  ('Connection aborted.', BadStatusLine("''",))<br>
  or
   ('Connection aborted.', error(10053, '')) 
  It omits the exception (by recording a Null in database) and continues to get the response of next period.</p>
  
  <p>However, the function stops working when encoutering a 10054 error.</p>
  
  <pre><code>Exception is:
   ('Connection aborted.', error(10054, '')) 
  </code></pre>
  
  <p>I check the database to find that all the response is Null after the time that the 10054 error comes.
  I firstly guess that the website may breakdown, thus no response is received.
  But when I manually restart the function, it starts to get response again.
  So that's no realated with breakdown of the website.</p>
  
  <p>I search in stackoverflow and find: Errno 10054 An existing connection was forcibly closed by the remote host.
  But I don't know how to resolve it.</p>
  
  <p>Could you please provide some solotion to this problem?(ideally speaking)
  or provide some solution to restart the function without manually restarting?
  (It looks like once I restart the funtion and it works again.)</p>
  
  <p>Thanks in advance.</p>