问题 I am trying to retrieve a file using urlretrieve , while adding a custom header. While checking the codesource of urllib.request I realized urlopen can take a Request object in parameter instead of just a string, allowing to put the header I want. But if I try to do the same with urlretrieve , I get a TypeError: expected string or bytes-like object as mentionned in this other post. What I ended up doing is rewriting my own urlretrieve, removing the line throwing the error (that line is