emont Wrote:That would be the problem, that URL cannot accessed from Internet but an Intranet.Ok,to look a little more at this,dos
file_2b_downloaded
give you the real download link?To give a example,you should test like this no loop or other stuff,just test the download.
Sample zip files download
import requests url = 'https://drive.google.com/uc?export=download&id=1o9DtaYEb1N-C_L7kqCAgfE0D5RaEwbZH' response = requests.get(url) with open('5mb.zip', 'wb') as f: f.write(response.content)So this works now because here i use the real download link,for the 5 mb sample zip file.
If parse out the link,look like this
import requests from bs4 import BeautifulSoup url = 'https://web-utility.com/en/sample/files/sample-zip-file-download' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') link = soup.select_one('div.col-md-3.col-3.text-right > a').get('href') response = requests.get(link) with open('5mb.zip', 'wb') as f: f.write(response.content)So this is a simpler case because download link is exposed and all can see it.
One more here i look at what is send over network Chrome dev-tool(inspect -> network),sometime can need to do this.
import requests headers = { 'authority': 'drive.google.com', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', } params = { 'export': 'download', 'id': '1o9DtaYEb1N-C_L7kqCAgfE0D5RaEwbZH', } response = requests.get('https://drive.google.com/uc', params=params, headers=headers) with open('5mb.zip', 'wb') as f: f.write(response.content)Also some cases can be using Selenium be easier,as if have to press a button before get the real download address.