BeautifulSoup: object of type 'Response' has no len()

You are getting response.content. But it return response body as bytes (docs). But you should pass str to BeautifulSoup constructor (docs). So you need to use the response.text instead of getting content.


Try to pass the HTML text directly

soup = BeautifulSoup(html.text)

If you're using requests.get('https://example.com') to get the HTML, you should use requests.get('https://example.com').text.