示例#1
0
 def test_open_viewing(self):
     daft = Daft()
     daft.set_open_viewing(True)
     daft.set_listing_type(RentType.APARTMENTS)
     listings = daft.search(fetch_all=False)
     self.assertTrue(len(listings) > 0)
     for listing in listings:
         self.assertTrue(len(listing.upcoming_viewings) > 0)
示例#2
0
 def test_open_viewing(self):
     daft = Daft()
     daft.set_county("Dublin")
     daft.set_open_viewing(True)
     daft.set_min_price(1000)
     daft.set_max_price(1500)
     daft.set_listing_type(RentType.APARTMENTS)
     listings = daft.get_listings()
     self.assertTrue(len(listings) > 0)
     for listing in daft.get_listings():
         self.assertTrue(len(listing.get_upcoming_viewings()) > 0)
示例#3
0
# Example to print a Listing object as dict.

from daftlistings import Daft, RentType, SortOrder, SortType
import pprint

daft = Daft(debug=True)

daft.set_county('Dublin')
daft.set_listing_type(RentType.APARTMENTS)
daft.set_sort_order(SortOrder.ASCENDING)
daft.set_sort_by(SortType.PRICE)
daft.set_with_photos(True)
daft.set_open_viewing(True)

listings = daft.search()

first = listings[0]

pprint.pprint(first.as_dict())