urllib.urlretrieve with custom header : <p>I am trying to retrieve a file using <code>urlretrieve</code>, while adding a custom header.</p>

<p>While checking the codesource of <code>urllib.request</code> I realized <code>urlopen</code> can take a <code>Request</code> object in parameter instead of just a string, allowing to put the header I want.
But if I try to do the same with <code>urlretrieve</code>, I get a <a href="https://stackoverflow.com/questions/43022570/urlretrieve-returning-typeerror">TypeError: expected string or bytes-like object</a> as mentionned in this other post. </p>

<p>What I ended up doing is rewriting my own urlretrieve, removing the line throwing the error (that line is irrelevant in my use case).</p>

<p><strong>It works fine</strong> but I am wondering if there is a <strong>better/cleaner</strong> way of doing it, rather than rewriting my own <code>urlretrieve</code>. If it is possible to pass a custom header to <code>urlopen</code>, it feels like it should be possible to do the same with <code>urlretrieve</code>?</p>
