title: Existing connection was forcibly closed by the remote host error while web scraping
body: <p>I am using python beautifulsoup and urllib.request to scrape weather data from the following website- </p>
  
  <pre><code>http://www.wunderground.com/history/airport/CYTZ/
  </code></pre>
  
  <p>Following is the code to fetch the webpage</p>
  
  <pre><code> # the new url created after each day
          theurl = "http://www.wunderground.com/history/airport/CYTZ/" + theDate + "/DailyHistory.html"
          # extract the source data for analysis
          thepage = urllib.request.urlopen(theurl)
          soup = BeautifulSoup(thepage, "html.parser")
  </code></pre>
  
  <p>I am able to scrape the data I need, but the program keeps terminating unexpectedly after giving few results with the following error -</p>
  
  <pre><code>URLError: &lt;urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host&gt;  
  </code></pre>
  
  <p>the number of results vary each time I run the program. Is there a particular way to stop this from happening and extract all the results in a single run? Thanks  </p>