Пример #1
0
 def test_apartments_to_let(self):
     daft = Daft()
     daft.set_offset(20)
     daft.set_listing_type(RentType.APARTMENTS)
     listings = daft.search(fetch_all=False)
     search_count = daft.search_count
     self.assertGreater(search_count, 0)
     self.assertGreater(len(listings), 0)
     apartment = listings[0]
     print(apartment.daft_link)
     self.assertIsNotNone(apartment.commercial_area_size)
     self.assertIsNotNone(apartment.contact_number)
     self.assertIsNotNone(apartment.daft_link)
     self.assertIsNotNone(apartment.date_insert_update)
     self.assertIsNotNone(apartment.facilities)
     self.assertIsNotNone(apartment.formalised_address)
     self.assertIsNotNone(apartment.id)
     self.assertIsNotNone(apartment.bathrooms)
     self.assertIsNotNone(apartment.bedrooms)
     self.assertIsNotNone(apartment.overviews)
     self.assertIsNotNone(apartment.price)
     self.assertIsNotNone(apartment.search_type)
     self.assertIsNotNone(apartment.shortcode)
     self.assertIsNotNone(apartment.views)
     self.assertIsNotNone(apartment.features)
     self.assertIsNotNone(apartment.advertiser_name)
     self.assertIsNotNone(apartment.date_insert_update)
     self.assertIsNotNone(apartment.hires_images)
Пример #2
0
    def test_apartments_to_let(self):
        daft = Daft()
        daft.set_listing_type(RentType.APARTMENTS)
        daft.set_area_type(AreaType.ENROUTE)
        daft.set_public_transport_route(TransportRoute.BUS_LINE_15)
        daft.set_min_lease(6)
        daft.set_max_lease(12)
        daft.set_offset(3)
        daft.set_sort_order(SortOrder.DESCENDING)
        daft.set_gender(Gender.EITHER)
        daft.set_availability(12)
        daft.set_pets_allowed(True)
        daft.set_keywords("Furnished")
        daft.set_couples_accepted(True)
        listings = daft.search(fetch_all=False)
        search_count = daft.search_count
        self.assertGreater(search_count, 0)
        self.assertGreater(len(listings), 0)
        apartment = listings[0]

        self.assertIsNotNone(apartment.commercial_area_size)
        self.assertIsNotNone(apartment.contact_number)
        self.assertIsNotNone(apartment.daft_link)
        self.assertIsNotNone(apartment.date_insert_update)
        self.assertIsNotNone(apartment.dwelling_type)
        self.assertIsNotNone(apartment.facilities)
        self.assertIsNotNone(apartment.formalised_address)
        self.assertIsNotNone(apartment.id)
        self.assertIsNotNone(apartment.bathrooms)
        self.assertIsNotNone(apartment.bedrooms)
        self.assertIsNotNone(apartment.overviews)
        self.assertIsNotNone(apartment.price)
        self.assertIsNotNone(apartment.search_type)
        self.assertIsNotNone(apartment.shortcode)
        self.assertIsNotNone(apartment.views)
        self.assertIsNotNone(apartment.features)
        self.assertIsNotNone(apartment.description)
        self.assertIsNotNone(apartment.advertiser_name)
        self.assertIsNotNone(apartment.agent)
        self.assertIsNotNone(apartment.agent_url)
        self.assertIsNotNone(apartment.ber_code)
        self.assertIsNotNone(apartment.city_center_distance)
        self.assertIsNotNone(apartment.date_insert_update)
        self.assertIsNotNone(apartment.hires_images)
Пример #3
0
from daftlistings import Daft, SortOrder, SortType, RentType, University, StudentAccommodationType

offset = 0

while True:
    daft = Daft()
    daft.set_listing_type(RentType.STUDENT_ACCOMMODATION)
    daft.set_university(University.NCI)
    daft.set_student_accommodation_type(
        StudentAccommodationType.ROOMS_TO_SHARE)
    daft.set_min_price(800)
    daft.set_max_price(1000)
    daft.set_sort_by(SortType.PRICE)
    daft.set_sort_order(SortOrder.ASCENDING)
    daft.set_offset(offset)
    listings = daft.search()

    if len(listings) == 0:
        break

    for listing in listings:
        facilities = listing.facilities
        if facilities is not None:
            if "Internet" in facilities:
                for facility in facilities:
                    print(facility)
                print(listing.price)
                print(listing.formalised_address)
                print(listing.daft_link)