From 935b63878d171a54f428ea484bee533799e2286e Mon Sep 17 00:00:00 2001 From: Brendan Scullion Date: Sun, 25 Jan 2026 00:03:46 +0000 Subject: [PATCH 1/2] Missing origin and referer header causing 403 response --- daftlistings/daft.py | 2 ++ examples/map_visualization.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/daftlistings/daft.py b/daftlistings/daft.py index 700318e..d8c433e 100644 --- a/daftlistings/daft.py +++ b/daftlistings/daft.py @@ -28,6 +28,8 @@ def __init__(self): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Origin": "https://www.daft.ie", + "Referer": "https://www.daft.ie/", } def set_headers(self, headers: Dict[str, str]): diff --git a/examples/map_visualization.py b/examples/map_visualization.py index fa1c00b..1c650cb 100644 --- a/examples/map_visualization.py +++ b/examples/map_visualization.py @@ -8,7 +8,6 @@ MapVisualization, ) - daft = Daft() daft.set_location(Location.DUBLIN) daft.set_search_type(SearchType.RESIDENTIAL_RENT) From 543c5b059cc747d2b05c50d66a82432a5b76562a Mon Sep 17 00:00:00 2001 From: Brendan Scullion Date: Sun, 25 Jan 2026 09:33:32 +0000 Subject: [PATCH 2/2] Add headers to test --- tests/test_daft_search.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_daft_search.py b/tests/test_daft_search.py index 1332675..0c407f3 100644 --- a/tests/test_daft_search.py +++ b/tests/test_daft_search.py @@ -44,6 +44,8 @@ def test_search_basic(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft() @@ -59,6 +61,8 @@ def test_custom_user_agent(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft() @@ -99,6 +103,8 @@ def test_search_properties_for_sale(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft() @@ -151,6 +157,8 @@ def test_search_properties_for_rent(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft() @@ -191,6 +199,8 @@ def test_search_multiple_areas(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft() @@ -220,6 +230,8 @@ def test_shared_listings(self, mock_post): "Content-Type": "application/json", "brand": "daft", "platform": "web", + "Referer": "https://www.daft.ie/", + "Origin": "https://www.daft.ie", } daft = Daft()