import urllib.request, urllib.error, urllib.parse
req = urllib.request.Request('http://www.example.com/')
req.add_header('Referer', 'http://www.python.org/')
r = urllib.request.urlopen(req)
setting referral url in python urllib.urlretrieve