Why it fails is revealed by the print in:
r = requests.get(urlImmagine, allow_redirects=True) img_data=r.content print('X:',indice,r.reason)