Giter VIP home page Giter VIP logo

Comments (5)

AnthonyBloomer avatar AnthonyBloomer commented on June 15, 2024

Hi @sdfordham, good spot. I think that print should be removed. In terms of getting the total number of properties, I'm thinking the regex method would be the quickest way to get the total number rather than having to iterate over each page to get the total count.

from daftlistings.

AnthonyBloomer avatar AnthonyBloomer commented on June 15, 2024

I added a new method search_count to the Daft class that returns the total number of properties.

Example usage:

from daftlistings import Daft, RentType

daft = Daft()
daft.set_listing_type(RentType.APARTMENT_TO_SHARE)

listings = daft.search()

print(daft.search_count)

from daftlistings.

sdfordham avatar sdfordham commented on June 15, 2024

I guess I was indirectly considering the following: if a user does listings = daft.search() then what should the result of that be? At the moment it puts 20 results into listings (or however many appear on page 1 of the search) but that seems kinda arbitrary. Should listings = daft.search() get back all the results into listings?

from daftlistings.

AnthonyBloomer avatar AnthonyBloomer commented on June 15, 2024

@sdfordham, you can use the offset method to increment the page number and iterate over each page. Having the search_count allows you to work out what that offset should be. However, I do like the idea of having the search method automatically get all listings. Perhaps this could be added as an optional param to the search method i.e (search(fetch_all=True)?

from daftlistings.

AnthonyBloomer avatar AnthonyBloomer commented on June 15, 2024

I'll close this issue and use #62 for further discussion.

from daftlistings.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.