title: Python urllib2.urlopen returning 302 error even though page exists
body: <p>I am using the Python function <code>urllib2.urlopen</code> to read the <a href="http://www.bad.org.uk/" rel="nofollow">http://www.bad.org.uk/</a> website but I keep getting a 302 error even though when I visit the site it loads ok.  Anyone have any idea why?</p>
  
  <pre><code>import socket 
  
  headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' }
  
  socket.setdefaulttimeout(10)
  
  try:
      req = urllib2.Request('http://www.bad.org.uk/', None, headers)
      urllib2.urlopen(req)
      return True         # URL Exist
  except ValueError, ex:
      print 'URL: %s not well formatted' % 'http://www.bad.org.uk/'
      return False        # URL not well formatted
  except urllib2.HTTPError, ex:
      print 'The server couldn\'t fulfill the request for %s.' % 'http://www.bad.org.uk/'
      print 'Error code: ', ex.code
      return False
  except urllib2.URLError, ex:
      print 'We failed to reach a server for %s.' % 'http://www.bad.org.uk/'
      print 'Reason: ', ex.reason
      return False        # URL don't seem to be alive
  </code></pre>
  
  <p>Error printed:</p>
  
  <pre><code>The server couldn't fulfill the request for http://www.bad.org.uk//site/1/default.aspx.
  Error code:  302
  </code></pre>