assuming my link is : web_link = 'https://link'
and my destination file that i want the content to be downloaded in is path
.
How can i download the content of web_link
in path
knowing that i'm using python2.7.
You can download using urllib:-
import urllib
urllib.urlretrieve("web_link", "path")
you can use requests
if weblink needs authentication :
import requests
r = requests.get(web_link, auth=('usrname', 'password'), verify=False,stream=True) #Note web_link is https://
r.raw.decode_content = True
with open("path", 'wb') as f:
shutil.copyfileobj(r.raw, f)
import urllib.request
urllib.request.urlretrieve("web_link", "path")