! pip install BeautifulSoupimport urllibimport refrom bs4 import BeautifulSoupimport timetime.sleep(1000)r = urllib.request.urlopen('https://bitcointalk.org/index.php?').read()soup = BeautifulSoup(r, 'html.parser')type(soup)
HTTPError: HTTP Error 403: Forbidden
import urllibimport requestsfrom bs4 import BeautifulSoupr = requests.get('https://bitcointalk.org/index.php')soup = BeautifulSoup(r.content, 'html.parser')print(soup)
import urllibimport requestsfrom bs4 import BeautifulSoupimport timer = urllib.request.Request('https://bitcointalk.org/index.php?', headers={'User-Agent': 'Mozilla/5.0'})response = urllib.request.urlopen(r)soup = BeautifulSoup(response.read(), 'html.parser')print(soup)