# 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("")
from daftlistings import Daft, RentType, RoomType, Gender daft = Daft() daft.set_listing_type(RentType.ROOMS_TO_SHARE) daft.set_room_type(RoomType.DOUBLE) daft.set_furnished(True) daft.set_county('Dublin City') daft.set_area('Castleknock') daft.set_gender(Gender.MALE) daft.set_with_photos(True) listings = daft.search() for listing in listings: print(listing.get_price) print(listing.formalised_address) print(listing.daft_link) print(listing.contact_number) print(' ')
from daftlistings import Daft, SaleType, HouseType, SortType import statsmodels.api as sm import pandas as pd import numpy as np from IPython.display import HTML daft = Daft() county = "Dublin" areas = ["Dublin 15", "Dublin 7"] #areas = ["Ashtown"] daft.set_listing_type(SaleType.HOUSES) daft.set_house_type(HouseType.DETACHED) daft.set_area(areas) daft.set_county(county) daft.set_sort_by(SortType.PRICE) df = pd.DataFrame() listings = daft.search() for listing in listings: # print(listing) try: data = pd.DataFrame([ listing.price, listing.bedrooms, listing.bathrooms, listing.dwelling_type, listing.ber_code, listing.floor_area, listing.town, listing.county, listing.daft_link ]).T
def test_area_commercial_properties(self): daft = Daft() daft.set_county("Dublin City") daft.set_listing_type(SaleType.COMMERCIAL) listings = daft.search() self.assertTrue(len(listings) > 0)
from daftlistings import Daft, SaleType import csv offset = 0 pages = True daft_data = [] #Check the fastest way to write a list into csv format! # while pages: #for pages in range(1): while pages: daft = Daft() daft.set_county('Dublin') #daft.set_area([]) daft.set_listing_type(SaleType.PROPERTIES) daft.set_offset(offset) listings = daft.get_listings() if not listings: pages = False for listing in listings: link = listing.get_daft_link() county = listing.get_county() town = listing.get_town() address = listing.get_formalised_address() price = listing.get_price() dwelling_type = listing.get_dwelling_type() bedrooms = listing.get_num_bedrooms()