Skip to content

Commit

Permalink
Merge pull request #167 from sdfordham/repair-rest-changes
Browse files Browse the repository at this point in the history
Repair rest changes
  • Loading branch information
AnthonyBloomer authored Nov 14, 2023
2 parents bbcc39f + dcb1f24 commit 48cbe0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
9 changes: 7 additions & 2 deletions daftlistings/daft.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@


class Daft:
_ENDPOINT = "https://search-gateway.dsch.ie/v1/listings"
_HEADER = {"Content-Type": "application/json", "brand": "daft", "platform": "web"}
_ENDPOINT = "https://gateway.daft.ie/old/v1/listings"
_HEADER = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
}
_PAGE_SZ = 50
_PAGE_0 = {"from": "0", "pagesize": str(_PAGE_SZ)}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run(self):

setup(
name="daftlistings",
version="2.0.3",
version="2.0.4",
description="A library that enables programmatic interaction with daft.ie. Daft.ie has nationwide coverage and contains about 80% of the total available properties in Ireland.",
long_description=long_descr,
long_description_content_type="text/markdown",
Expand Down
15 changes: 10 additions & 5 deletions tests/test_daft_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
class DaftTest(unittest.TestCase):
@patch("requests.post")
def test_search_basic(self, mock_post):
url = "https://search-gateway.dsch.ie/v1/listings"
url = "https://gateway.daft.ie/old/v1/listings"
payload = {
"paging": {"from": "0", "pagesize": "50"},
}
headers = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
Expand All @@ -36,7 +37,7 @@ def test_search_basic(self, mock_post):

@patch("requests.post")
def test_search_properties_for_sale(self, mock_post):
url = "https://search-gateway.dsch.ie/v1/listings"
url = "https://gateway.daft.ie/old/v1/listings"
payload = {
"section": "residential-for-sale",
"andFilters": [
Expand All @@ -62,6 +63,7 @@ def test_search_properties_for_sale(self, mock_post):
"paging": {"from": "0", "pagesize": "50"},
}
headers = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
Expand Down Expand Up @@ -92,7 +94,7 @@ def test_search_properties_for_sale(self, mock_post):

@patch("requests.post")
def test_search_properties_for_rent(self, mock_post):
url = "https://search-gateway.dsch.ie/v1/listings"
url = "https://gateway.daft.ie/old/v1/listings"
payload = {
"section": "residential-to-rent",
"andFilters": [
Expand All @@ -113,6 +115,7 @@ def test_search_properties_for_rent(self, mock_post):
"paging": {"from": "0", "pagesize": "50"},
}
headers = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
Expand Down Expand Up @@ -142,7 +145,7 @@ def test_search_properties_for_rent(self, mock_post):

@patch("requests.post")
def test_search_multiple_areas(self, mock_post):
url = "https://search-gateway.dsch.ie/v1/listings"
url = "https://gateway.daft.ie/old/v1/listings"
payload = {
"section": "residential-to-rent",
"geoFilter": {
Expand All @@ -152,6 +155,7 @@ def test_search_multiple_areas(self, mock_post):
"paging": {"from": "0", "pagesize": "50"},
}
headers = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
Expand All @@ -169,7 +173,7 @@ def test_search_multiple_areas(self, mock_post):

@patch("requests.post")
def test_shared_listings(self, mock_post):
url = "https://search-gateway.dsch.ie/v1/listings"
url = "https://gateway.daft.ie/old/v1/listings"
payload = {
"section": "sharing",
"filters": [
Expand All @@ -180,6 +184,7 @@ def test_shared_listings(self, mock_post):
"paging": {"from": "0", "pagesize": "50"},
}
headers = {
"User-Agent": "",
"Content-Type": "application/json",
"brand": "daft",
"platform": "web",
Expand Down

0 comments on commit 48cbe0c

Please # to comment.