Requests does not download files > that 4MB

Asked

Viewed 84 times

1

I’m using requests in python, and I can’t download files larger than 4mb (maybe a little smaller too). I am downloading some PDF, and I can download small files normally, but when I use a slightly larger file, it just saves the name and leaves it as a blank file. I used CURL and it downloaded normally, but when I use CURL inside python instead of request, it also does not download.

def download_file(url,name):
#response = requests.get(url, stream=True, allow_redirects=True)
#pdf_url = response.url
#handle = open(name+".pdf", "wb")
#for chunk in response.iter_content(chunk_size=512):
#    if chunk:  
#        handle.write(chunk)

os.system('curl "{}" -o "{}".pdf'.format(url,name))

Is there a file size limiter I’m creating? I searched about and found nothing on....

  • Any error message appears?

  • Is it not being limited by the server? Has server that tries to block the action of bots and crawlers.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.