title: How to raise HTTPError
body: <p>To test some code which uses <a href="https://docs.python.org/2/library/urllib2.html" rel="nofollow"><strong><code>urllib2</code></strong></a>, I want to raise an <a href="https://docs.python.org/2/library/urllib2.html#urllib2.HTTPError" rel="nofollow"><strong><code>HTTPError</code></strong></a> to make sure it is handled correctly.</p>
  
  <p><code>HTTPError</code> has a constructor:</p>
  
  <pre><code>def __init__(self, url, code, msg, hdrs, fp):
  </code></pre>
  
  <p>I don't know what to pass as the last argument <code>fp</code>.</p>
  
  <p>Can you help me with an example that will raise an <code>HTTPError</code> e.g. 
  <code>raise HTTPError('arg1','arg2','arg3','arg4',...</code></p>
  
  <p>How can it be done?</p>