Fixed handling of urlopen result to work properly under both python 2.4 and python 2.6