how to redirect where requests library downloads file python

Solutions on MaxInterview for how to redirect where requests library downloads file python by the best coders in the world

showing results for - "how to redirect where requests library downloads file python"
Noah
10 Aug 2017
1import requests
2 
3file_url = 'https://www.journaldev.com/wp-content/uploads/2019/08/Python-Tutorial.png'
4 
5file_object = requests.get(file_url)
6 
7with open('Python-Tutorial.png', 'wb') as local_file:
8    local_file.write(file_object.content)
9
10#The file will be downloaded in the same directory as the Python script.
11#If you want to change the directory location,
12#you can provide a complete path or relative path in the open() function call.
13