help please download the specified page and find her element with id =''login ". necessarily need to use for the query module request
import pprint
import requests
import bs4
url = 'http://forum.saransk.ru/'
html = requests.get(url)
#print(html.text)
soup = bs4.BeautifulSoup(html)
loginForm = soup.find('form', {'id': 'login'})
pprint.pprint(loginForm)
error message:
Traceback (most recent call last): File "C:\VINT\OPENSERVER\OpenServer\domains\localhost\python\parse_html\4_auth\q.py", line 9, in soup = bs4.BeautifulSoup(html) File "C:\Python33\lib\site-packages\bs4__init__.py", line 162, in init elif len(markup) <= 256: TypeError: object of type 'Response' has no len()
You need to pass the actual html not the request :
soup = bs4.BeautifulSoup(html.text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With