title: Can I tell a script to pause when the wifi goes down?
body: <p>I have a python scraping script.</p>
  
  <p>At many points, the code has to interact with websites.</p>
  
  <p>Sometimes the code crashes because my wifi signal drops.</p>
  
  <p>I have been told that I should use: </p>
  
  <pre><code>try: except urllib2.URLError as e:
  </code></pre>
  
  <p>as a block around the problem parts of the code. But the code has many lines that interact with websites, with other things in between.</p>
  
  <p>My question is, do I need to use this block around every line of code that interacts with a website? Or is there something else fancy that I could do that would just tell the <strong>whole</strong> script "if you're having a problem connecting to the internet at any point, just wait 10 seconds and try that line again". </p>