def test_shared_listings(self, mock_post): url = "https://search-gateway.dsch.ie/v1/listings" payload = { "section": "sharing", "filters": [ { "name": "suitableFor", "values": ["male"] }, { "name": "ownerOccupied", "values": [True] }, ], "ranges": [{ "name": "numTenants", "from": "1", "to": "1" }], "paging": { "from": "0", "pagesize": "50" }, } headers = { "Content-Type": "application/json", "brand": "daft", "platform": "web", } daft = Daft() daft.set_search_type(SearchType.SHARING) daft.set_suitability(SuitableFor.MALE) daft.set_min_tenants(1) daft.set_max_tenants(1) daft.set_owner_occupied(True) daft.search() mock_post.assert_called_with(url, headers=headers, json=payload)
from daftlistings import Daft, Location, SearchType, SuitableFor daft = Daft() daft.set_location(Location.DUBLIN) daft.set_search_type(SearchType.SHARING) daft.set_owner_occupied(True) daft.set_min_tenants(1) daft.set_max_tenants(1) daft.set_suitability(SuitableFor.MALE) daft.set_min_price(1000) daft.set_max_price(1000) listings = daft.search() for listing in listings: print(listing.title) print(listing.daft_link) print("")