title: How to debug urllib2 request that uses a basic authentication handler
body: <p>I'm making a request using <code>urllib2</code> and the <code>HTTPBasicAuthHandler</code> like so:</p>
  
  <pre><code>import urllib2
  
  theurl = 'http://someurl.com'
  username = 'username'
  password = 'password'
  
  passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
  passman.add_password(None, theurl, username, password)
  
  authhandler = urllib2.HTTPBasicAuthHandler(passman)
  opener = urllib2.build_opener(authhandler)
  urllib2.install_opener(opener)
  
  params = "foo=bar"
  
  response = urllib2.urlopen('http://someurl.com/somescript.cgi', params)
  
  print response.info()
  </code></pre>
  
  <p>I'm currently getting a <code>httplib.BadStatusLine</code> exception when running this code. How could I go about debugging? Is there a way to see what the raw response is regardless of the unrecognized HTTP status code?</p>