'Response' has no len()

188 views
Skip to first unread message

Denis Picard

unread,
Apr 20, 2017, 6:59:15 AM4/20/17
to beautifulsoup
Hi !
I use for the first time BeautifulSoup (4.4.1).
My spider is :

import requests
from bs4 import BeautifulSoup

thisurl = 'http://kaino.kotus.fi/algu/index.php'
donnees = {'t' : 'sanue','kkieli' :'en','lekseemi_id' :'24485','hakusana':'addes','sanue_id':'9170'}
r= requests.get(thisurl,params=donnees)
r.encoding = 'utf-8'

soup = BeautifulSoup(r,'lxml')

print(soup.prettify())

And the error is... :

Traceback (most recent call last):
  File "spider3.py", line 37, in <module>
    soup = BeautifulSoup(r,'lxml')
  File "/usr/lib/python3/dist-packages/bs4/__init__.py", line 176, in __init__
    elif len(markup) <= 256:
TypeError: object of type 'Response' has no len()

What can I do ?

Reply all
Reply to author
Forward
0 new messages