Response Code 202, Not a Qualified Error Code
<p>I'm working with an API which I post files to. However, when I receive the response, the HTTP status code is a 202. This is to be expected, but in addition the API will also respond with XML content.</p>

<p>So in my try/except block urllib2.urlopen will result in a raised urllib2.HTTPError and destroying the XML content.</p>

<pre><code>try:
    response = urllib2.urlopen(req)
except urllib2.HTTPError, http_e:
    if http_e.code == 202:
        print 'accepted!'
        pass

print response.read() # UnboundLocalError: local variable 'response' referenced before assignment
</code></pre>

<p>How can I expect the 202 and keep the response content, but not raise an error?</p>
