|
|
@ -77,7 +77,7 @@ def retrieve_url(url): |
|
|
|
def download_file(url, referer=None): |
|
|
|
def download_file(url, referer=None): |
|
|
|
""" Download file at url and write it to a file, return the path to the file and the url """ |
|
|
|
""" Download file at url and write it to a file, return the path to the file and the url """ |
|
|
|
file, path = tempfile.mkstemp() |
|
|
|
file, path = tempfile.mkstemp() |
|
|
|
file = os.fdopen(file, "w") |
|
|
|
file = os.fdopen(file, "wb") |
|
|
|
# Download url |
|
|
|
# Download url |
|
|
|
req = urllib.request.Request(url) |
|
|
|
req = urllib.request.Request(url) |
|
|
|
if referer is not None: |
|
|
|
if referer is not None: |
|
|
|