Answers for "how to redirect where requests library downloads file python"

0

how to redirect where requests library downloads file python

import requests
 
file_url = 'https://www.journaldev.com/wp-content/uploads/2019/08/Python-Tutorial.png'
 
file_object = requests.get(file_url)
 
with open('Python-Tutorial.png', 'wb') as local_file:
    local_file.write(file_object.content)

#The file will be downloaded in the same directory as the Python script.
#If you want to change the directory location,
#you can provide a complete path or relative path in the open() function call.
Posted by: Guest on July-08-2020

Code answers related to "how to redirect where requests library downloads file python"

Python Answers by Framework

Browse Popular Code Answers by Language