There is a link with a gif image, but urllib2 can't download it.
import urllib.request as urllib2
uri = 'http://ums.adtechjp.com/mapuser?providerid=1074;userid=AapfqIzytwl7ks8AA_qiU_BNUs8AAAFYqnZh4Q'
try:
req = urllib2.Request(uri, headers={ 'User-Agent': 'Mozilla/5.0' })
file = urllib2.urlopen(req)
except urllib2.HTTPError as err:
print('HTTP error!!!')
file = err
print(err.code)
except urllib2.URLError as err:
print('URL error!!!')
print(err.reason)
return
data = file.read(1024)
print(data)
After script finishes, data remains empty. Why does it happen? There is no HTTPError, I can see in browser console that there is a valid gif and status of HTTP responce is 200 OK. Thank you.