I have this code:
import shutil
import urllib.request
import zipfile
url = "http://wwww.some-file.com/my-file.zip"
file_name = url.split('/')[-1]
with urllib.request.urlopen(url) as response, open(file_name, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
with zipfile.ZipFile(file_name) as zf:
zf.extractall()
When trying the code I receive the following error:
urllib.error.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Found
I have been trying to combine solutions from here and here with no luck. Can anyone help me? Thanks