Fetch a website (Python)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
#! /usr/bin/python3
#
# Download Channable-XML-file - Strompf, Feb. 2019
##############################################################################
#
import urllib.request


url = 'https://www.example.com/fr-fr_channable.xml'
response = urllib.request.urlopen(url)
data = response.read()      # a `bytes` object
text = data.decode('utf-8') # a `str`; this step can't be used if data is binary

print(text)

Bronnen