import bs4
import urllib.request as urllib_request
import pandas
from urllib.request import urlopen
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
url = 'https://statusinvest.com.br'
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 OPR/72.0.3815.459'}
# A sequencia de try e except abaixo deve estar necessariamente NESTA SEQUENCIA
try:
req = Request(url, headers = headers)
response = urlopen(req)
print(response.read())
except HTTPError as e:
print(e.status, e.reason)
except URLError as e:
print(e.reason)
html = response.read()
html
O output:
b''
Não entendi o de onde veio o (b'')