1
How do i use BS4? (PYTHON
AzureScripts (130)

soup = BeautifulSoup(results_page.content(), 'html.parser')
Is my line of code

Traceback (most recent call last):
File "main.py", line 13, in <module>
soup = BeautifulSoup(results_page.content(), 'html.parser')
TypeError: 'bytes' object is not callable

is the error code

You are viewing a single comment. View All
2
21natzil (690)

This is an issue with the requests library you're using. the content attribute is not a function, but bytes containing the website's response. But instead of passing .content into BS4, you should instead use .text which is a string. So it'd look like

soup = BeautifulSoup(results_page.text, 'html.parser')