3 ways for Python to get Internet resources

3 ways for Python to get Internet resources

[1] Using requests

import requests

URL = "https://instagram.com/favicon.ico"

response = requests.get(URL)

open("instagram.ico", "wb").write(response.content)

[2] Using wget

pip install wget

import wget

URL = "https://instagram.com/favicon.ico"

response = wget.download(URL, "instagram.ico")

[3] Using urllib

pip install urllib

from urllib import request

URL = "https://instagram.com/favicon.ico"

response = request.urlretrieve("https://instagram.com/favicon.ico", "instagram.ico")

source:

https://www.logilax.com/python-download-file-from-url/