urllib makes it difficult to send arbitrary headers with a request; you can use urllib2 , which allows you to create and send a Request object with arbitrary headers (including, of course, sadly written ;-) - Referer ). It does not offer urlretrieve , but you just urlopen , like you, and copy the resulting file-like object to disk if you want (directly or, for example, via shutil ).
Alex martelli
source share