urllib2 compatiblity