Skip to main content

A library that enables programmatic interaction with daft.ie.

Project description

A library that enables programmatic interaction with daft.ie allowing you to retrieve properties by location, sale type, price and property type. daftlistings has been tested on Python 2.7 and Python 3.5.2

Install

daftlistings is available on the Python Package Index (PyPI) at https://pypi.python.org/pypi/daftlistings

You can install daftlistings using pip.

pip install daftlistings

Development Version

This library is under active development. Before new versions are pushed to PyPI, you can download the development version to avail of any new features.

git clone https://github.com/AnthonyBloomer/daftlistings.git
cd daftlistings
virtualenv env
source env/bin/activate
pip install -r requirements.txt

Examples

Get the current properties for rent in Dublin that are between €1000 and €1500 per month and contact the advertiser for each listing.

from daftlistings import Daft, CommercialType, SaleType, RentType

daft = Daft()
daft.set_county('Dublin City')
daft.set_area('Dublin 15')
daft.set_listing_type(RentType.APARTMENTS)
daft.set_min_price(1000)
daft.set_max_price(1500)

listings = daft.get_listings()

for listing in listings:
    print(listing.get_formalised_address())
    print(listing.get_daft_link())

    contact = listing.contact_advertiser(
        name="Jane Doe",
        contact_number="019202222",
        email="jane@example.com",
        message="Hi, I seen your listing on daft.ie and I would like to schedule a viewing."
    )

    if contact:
        print("Message sent")

Retrieve commercial office listings in Dublin.

daft.set_county("Dublin")
daft.set_listing_type(SaleType.COMMERCIAL)
daft.set_commercial_property_type(CommercialType.OFFICE)

listings = daft.get_listings()

for listing in listings:
    print(listing.get_formalised_address())
    print(listing.get_daft_link())

Get the current sale agreed prices for properties in Dublin.

daft.set_county('Dublin City')
daft.set_area('Dublin 15')
daft.set_listing_type(SaleType.PROPERTIES)
daft.set_min_price(1000)
daft.set_max_price(1500)
daft.set_sale_agreed(True)

listings = daft.get_listings()

for listing in listings:
    print(listing.get_formalised_address())
    print(listing.get_daft_link())

You can sort the listings by price, distance, upcoming viewing or date using the SortType object. The SortOrder object allows you to sort the listings descending or ascending. For example:

from daftlistings import SortOrder, SortType

daft.set_county('Dublin City')
daft.set_area('Dublin 15')
daft.set_listing_type(SaleType.PROPERTIES)
daft.set_min_price(150000)
daft.set_max_price(175000)
daft.set_sort_order(SortOrder.ASCENDING)
daft.set_sort_by(SortType.PRICE)


listings = daft.get_listings()

for listing in listings:
    print(listing.get_formalised_address())
    print(listing.get_daft_link())
    print(listing.get_price())

Retrieve all properties for sale in Dublin 15. This example loops through each page of listings and prints the result.

offset = 0
pages = True

while pages:

    daft.set_county('Dublin City')
    daft.set_area('Dublin 15')
    daft.set_listing_type(SaleType.PROPERTIES)
    daft.set_offset(offset)

    listings = daft.get_listings()

    if not listings:
        pages = False

    for listing in listings:
        print(listing.get_agent_url())
        print(listing.get_price())
        print(listing.get_formalised_address())
        print(listing.get_daft_link())
        print(' ')


    offset += 10

Find student accommodation near Trinity College Dublin that is between 800 and 1000 per month.

daft.set_listing_type(RentType.STUDENT_ACCOMMODATION)
daft.set_university(University.TCD)
daft.set_student_accommodation_type(StudentAccommodationType.ROOM_TO_SHARE)
daft.set_min_price(800)
daft.set_max_price(1000)
daft.set_sort_by(SortType.PRICE)
daft.set_sort_order(SortOrder.ASCENDING)
listings = daft.get_listings()

for listing in listings:
    print(listing.get_price())
    print(listing.get_formalised_address())
    print(listing.get_daft_link())
    print(' ')

Documentation

The current documentation can be viewed here: https://anthonybloomer.github.io/daftlistings/

The documentation has been created using mkdocs.

To update the documentation, clone the repository and edit docs/index.md

To view your changes, run:

mkdocs serve

To build the documentation, run:

mkdocs build

This will create a directory called site. Copy the site directory to a new directory and checkout gh-pages

git checkout gh-pages

Copy any changes from the site directory to this directory and push your changes.

Contributing

  • Fork the project and clone locally.

  • Create a new branch for what you’re going to work on.

  • Push to your origin repository.

  • Create a new pull request in GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

daftlistings-1.1.6.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daftlistings-1.1.6-py2.py3-none-any.whl (13.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file daftlistings-1.1.6.tar.gz.

File metadata

  • Download URL: daftlistings-1.1.6.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for daftlistings-1.1.6.tar.gz
Algorithm Hash digest
SHA256 f0a625d24d46619f009a07c3311c8f9e1f09c8124930d07f8ad819bf6c3a0d62
MD5 22db98bf54df6bf8e9a701b82dbc0fdb
BLAKE2b-256 a49e14e6935aa315e1193591f0d976bf9fd13f4710904a5cbc9b2d396728a3dc

See more details on using hashes here.

File details

Details for the file daftlistings-1.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for daftlistings-1.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 63906d729a22b1645de6a7c7fc6e385b8461b373e3cd2b5ad3463f62e83ecb73
MD5 344e74794c350940cce3b934ba643ee0
BLAKE2b-256 b7f58b979c931eeaf274c2b7d3fd8de1164a552ebbfc471c688c2fbb04e9fea9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page