Catch exception from urlopen() and retry on HTTP500