I am using requests library of python to download a file of size approx. 40mb. But with my code i am getting file of size 14mb only. It is not showing any error(few warnings though before download file).
here is my code:
import requests
file_url = "https://file_url.tar"
user='username'
passw='password'
r = requests.get(file_url,auth=(user,passw),verify=False, stream = True)
with open("c.tar","wb") as code:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
code.write(chunk)
I tried using without 'stream=True' too. but that also not working.
When i am puting this URL in browser i am getting complete file of 40 mb.
I tried this script on some other machine and it is working fine there(and i am getting those warnings here too).
These are the warnings i am getting:
SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning
InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
but i don't think there is a problem because of this because if i am running this script on some other system i am getting these warnings but script is working fine.