Follow link redirection & Assign Name to Material in Python

Hi all, im a bit stucked with two things:

how to assign a name to a material in python?

and:

i try to access a picture by a link which is redirected to another link. so the script should follow the redirections and download the texture there. (without redirections the script works fine). in the attachment you find the file.

thanks so so much for your help and thanks so far for the help form @clement for my first plugin :innocent:

all the best
michael

mtextur.py (3.9 KB)