Skip to content

Commit 60c6446

Browse files
DAFT-4: Fix double-parsing HTML (TheJokersThief#4)
1 parent db07355 commit 60c6446

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

daft_scraper/search/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def _extract_json(self, page_html: BeautifulSoup):
6969
def _get_page_data(self, path, params):
7070
"""Request a page and parse its JSON"""
7171
page = self.site.get(path, params=params)
72-
page = BeautifulSoup(page)
7372
return self._extract_json(page)
7473

7574
def _get_listings(self, listings: dict):

tests/test_search.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
# -*- coding: utf-8 -*-
33
import mock
44
import unittest
5+
from bs4 import BeautifulSoup
56

67
from daft_scraper.search import DaftSearch, SearchType
78
from daft_scraper.search.options import PropertyType, PropertyTypesOption, Facility, FacilitiesOption, PriceOption, BedOption
89
from daft_scraper.search.options_location import LocationsOption, Location
910

1011

1112
with open('tests/fixtures/sample_page.html') as file:
12-
SEARCH_PAGE_HTML = file.read()
13+
SEARCH_PAGE_HTML = BeautifulSoup(file.read(), features="html.parser")
1314

1415

1516
class TestDaftScraper(unittest.TestCase):

0 commit comments

Comments
 (0)