예제 #1
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)
예제 #2
0
# Get the current properties for rent in Dublin that are between 1000 and 1500 per month.

from daftlistings import Daft, RentType

daft = Daft()

daft.set_county("Dublin City")
daft.set_listing_type(RentType.APARTMENTS)
daft.set_min_price(1000)
daft.set_max_price(1500)
daft.set_furnished(True)
daft.set_keywords(["quiet"])

listings = daft.search()

for listing in listings:
    print(listing.formalised_address)
    facilities = listing.facilities
    if facilities is not None:
        print("Facilities: ")

        for facility in facilities:
            print(facility)

    features = listing.features
    if features is not None:
        print("Features: ")
        for feature in features:
            print(feature)

    print("")
예제 #3
0
# Get the current properties for rent in Dublin that are between 1000 and 1500 per month.

from daftlistings import Daft, RentType

daft = Daft()

daft.set_county("Dublin City")
daft.set_listing_type(RentType.APARTMENTS)
daft.set_min_price(1000)
daft.set_max_price(1500)
daft.set_furnished(True)
daft.set_keywords(['quiet'])

listings = daft.search()

for listing in listings:
    print(listing.formalised_address)
    facilities = listing.facilities
    if facilities is not None:
        print('Facilities: ')

        for facility in facilities:
            print(facility)

    features = listing.features
    if features is not None:
        print('Features: ')
        for feature in features:
            print(feature)

    print("")