I'm trying to run this for loop to scrape some data from a website.
from bs4 import BeautifulSoup
import requests
source = requests.get('https://atp-ejendomme.dk/find-lejemaal/christiansbro/')
soup = BeautifulSoup(source, 'lxml')
for div in soup.find_all('div', class_='fact no-hover'):
fact_title = div.find('p', class_='fact_title tag visible')
print(fact_title)
fact_answer = div.find('p', class_='fact_answer tag visible')
print(fact_answer)
print()
But when I run it I get this error
Traceback (most recent call last):
File "/Users/officehub/Desktop/Scrapers/atpScraper.py", line 21, in <module>
soup = BeautifulSoup(source, 'lxml')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/bs4/__init__.py", line 307, in __init__
elif len(markup) <= 256 and (
TypeError: object of type 'Response' has no len()