title: How do I catch a specific HTTP error in Python?
body: <p>I have</p>
  <pre><code>import urllib2
  try:
     urllib2.urlopen(&quot;some url&quot;)
  except urllib2.HTTPError:
     &lt;whatever&gt;
  </code></pre>
  <p>but what I end up is catching any kind of HTTP error. I want to catch only if the specified webpage doesn't exist (404?).</p>