"TypeError: object of type 'Response' has no len()"
Full error message
When I try to execute the code BeautifulSoup(html, ...) it gives the error message TypeError: object of type 'Response' has no len() I tried passing the actual HTML as a parameter, but it still doesn't work. import requests url = 'http://vineoftheday.com/?order_by=rating' response = requests.get(url) html = response.content soup = BeautifulSoup(html, "html.parser")
Solutionsource: stackoverflow \u2197
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.
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/551c7f71ef1ee037fcad3899cc55d0eb5a786c534aac102bf096b6174cf9a837hash \u00b7 551c7f71ef1ee037fcad3899cc55d0eb5a786c534aac102bf096b6174cf9a837