HTTP Error code Info

David wizzardx at gmail.com
Sun May 4 14:25:03 EDT 2008


> block.  Is there any better way to get the HTTP Error code using urllib2
> lib. Something like know the  exact  response number (200, 404 etc) without
> the above block.

Python libraries usually throw exceptions to indicate error conditions.

If this is a problem in your app then can write a wrapper function
which captures the HTTPError exception, extracts the code, and returns
it to the caller.

David.



More information about the Python-list mailing list