question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fetched 0 listings

See original GitHub issue

Great project! Thanks for sharing. Regardless of the query I currently only see the url for the REST api and “Fetched 0 listings”. Any thoughts on why this might be?

My current guesses are:

  • Silliness on my part
  • A daft.ie API change
  • some authentication required that I don’t know about

Any help would be much appreciated.

An example of what I am running (with a dev install from master):

from daftlistings import Daft, SortOrder, SortType, SaleType, MapVisualization
import pandas as pd

daft = Daft()
daft.set_county("Dublin")
daft.set_sort_by(SortType.PRICE)
# must sort by price in asending order, MapVisualization class will take care of the weekly/monthly value mess
daft.set_min_price(400000)
daft.set_max_price(800000)
listings = daft.search(fetch_all=True)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AnthonyBloomercommented, Mar 21, 2021

@YifeiLuDublin I’ve been looking into how the internal Daft API works and how we can filter data using a JSON payload. I’ve figured out most things except how to filter by location. This is an example class:

import requests
from pprint import pprint


class Daft:
    
    def __init__(self):
        self._min_beds = 1
        self._max_beds = 2
        self._min_price = 1500
        self._max_price = 2500
        

    @property
    def min_beds(self):
        return self._min_beds

    @min_beds.setter
    def min_beds(self, min_beds):
        self._min_beds = min_beds

    @property
    def max_beds(self):
        return self._max_beds

    @max_beds.setter
    def max_beds(self, max_beds):
        self._max_beds = max_beds

    @property
    def min_price(self):
        return self._min_price

    @min_price.setter
    def min_price(self, min_price):
        self._min_price = min_price

    @property
    def max_price(self):
        return self._max_price

    @max_price.setter
    def max_price(self, max_price):
        self._max_price = max_price

    def search(self):
        r = requests.post("https://search-gateway.dsch.ie/v1/listings", headers={
            "Content-Type": "application/json",
            "brand": "daft",
            "platform": "web"
        }, json={
            "section": "residential-to-rent",
            "filters":
                [
                    {
                        "name": "adState",
                        "values":
                            [
                                "published"
                            ]
                    },
                    {
                        "values":
                            [
                                "unfurnished"
                            ],
                        "name": "furnishing"
                    }
                ],

            "andFilters":
                [
                    {
                        "values":
                            [
                                "alarm"
                            ],
                        "name": "facilities"
                    }
                ],

            "ranges":
                [
                    {
                        "from": self.min_price,
                        "to": self.max_price,
                        "name": "rentalPrice"
                    },
                    {
                        "from": self.min_beds,
                        "to": self.max_beds,
                        "name": "numBeds"
                    },
                    {
                        "from": "12",
                        "to": "",
                        "name": "leaseLength"
                    }
                ],
            "paging":
                {
                    "from": "0",
                    "pageSize": "20"
                },
            "terms": ""
        }, )
        return r.json()


if __name__ == '__main__':
    daft = Daft()
    daft.min_beds = 1
    daft.max_beds = 2
    daft.min_price = 1500
    daft.max_price = 2000
    listings = daft.search()
    for listing in listings['listings']:
        pprint(listing)
        

What I was thinking is that the Daft class would be responsible for building the JSON payload based on what the user sets which is similar to how this library worked previously except no scraping would be necessary 😃

1reaction
sdfordhamcommented, Feb 27, 2021

Hello @leej3, daft.ie updated their site recently which broke this library. I’ve been busy lately so haven’t had time to fix this. I do intend to look into it soon. In the meantime, I would recommend checking out daft-scraper which is a similar project to this and works with the new Daft website. Hope that helps!

Similar is an understatement, one wonders why the creator didn’t just fork and fix this lib.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetched 0 records in Robo3T - mongodb - Stack Overflow
When I used a simple where statement I got the message: "Fetched 0 records". I tried with the simplest commands and all returned...
Read more >
How to List a Single Item Using Single Fetch and eBay File ...
Get Sku Grid: http://skugrid.com/web/?ref=FreeGiftGet the Chrome Extension: ...
Read more >
How to List a Single Item Using Single Fetch & Quick Lister
https://app.skufetch.comhttps:// list.wiselister.comIn this video, we will show you how to list a single item using Single Fetch & Quick ...
Read more >
git-fetch Documentation - Git
git-fetch - Download objects and refs from another repository ... Write the list of remote refs fetched in the FETCH_HEAD file directly under...
Read more >
fetch() - Web APIs | MDN
The global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found