class MyURLopener(urllib.URLopener):
# Error 301 -- relocated (permanently)
def http_error_301(self, url, fp, errcode, errmsg, headers, data=None):
- if headers.has_key('location'):
+ if 'location' in headers:
newurl = headers['location']
- elif headers.has_key('uri'):
+ elif 'uri' in headers:
newurl = headers['uri']
else:
newurl = "Nowhere"