{"id":1081,"hash":"551c7f71ef1ee037fcad3899cc55d0eb5a786c534aac102bf096b6174cf9a837","pattern":"&quot;TypeError: object of type &#39;Response&#39; has no len()&quot;","full_message":"When I try to execute the code\n\nBeautifulSoup(html, ...)\n\nit gives the error message\n\nTypeError: object of type 'Response' has no len()\n\nI tried passing the actual HTML as a parameter, but it still doesn't work.\n\nimport requests\n\nurl = 'http://vineoftheday.com/?order_by=rating'\nresponse = requests.get(url)\nhtml = response.content\n\nsoup = BeautifulSoup(html, \"html.parser\")","ecosystem":"pypi","package_name":"web-scraping","package_version":null,"solution":"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.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/36709165/typeerror-object-of-type-response-has-no-len","votes":45,"created_at":"2026-04-19T04:52:18.513897+00:00","updated_at":"2026-04-19T04:52:18.513897+00:00"}