Python library that enables Programmatic interaction with [Daft.ie](https://daft.ie)
## Installation
daftlistings is available on the Python Package Index (PyPI). You can install daftlistings using pip.
``` bash
virtualenv env
source env/bin/activate
pip install daftlistings
```
To install the development version, run:
``` bash
pip install https://github.com/AnthonyBloomer/daftlistings/archive/dev.zip
```
## Examples
Get apartments to let in Dublin City that are between €1000 and €1500 and contact the advertiser of each listing.
``` python
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)
listings = daft.search()
if len(listings) > 0:
first = listings[0]
contact = first.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("Advertiser contacted")
```
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.
``` python
from daftlistings import Daft, SortOrder, SortType, RentType
daft = Daft()
daft.set_county("Dublin City")
daft.set_listing_type(RentType.ANY)
daft.set_sort_order(SortOrder.ASCENDING)
daft.set_sort_by(SortType.PRICE)
daft.set_max_price(2500)
listings = daft.search()
for listing in listings:
print(listing.formalised_address)
print(listing.daft_link)
print(listing.price)
features = listing.features
if features is not None:
print('Features: ')
for feature in features:
print(feature)
print("")
```
Parse listing data from a given search result url.
``` python
from daftlistings import Daft
offset = 0
while 1:
daft = Daft()
daft.set_result_url("https://www.daft.ie/dublin-city/new-homes-for-sale/?ad_type=new_development")
daft.set_offset(offset)
listings = daft.search()
if not listings:
break
for listing in listings:
print(listing.formalised_address)
print(listing.price)
print(' ')
offset += 10
```
Find student accommodation near UCD that is between 850 and 1000 per month
``` python
from daftlistings import Daft, SortOrder, SortType, RentType, University, StudentAccommodationType
daft = Daft()
daft.set_listing_type(RentType.STUDENT_ACCOMMODATION)
daft.set_university(University.UCD)
daft.set_student_accommodation_type(StudentAccommodationType.ROOMS_TO_SHARE)
daft.set_min_price(850)
daft.set_max_price(1000)
daft.set_sort_by(SortType.PRICE)
daft.set_sort_order(SortOrder.ASCENDING)
daft.set_offset(offset)
listings = daft.search()
for listing in listings:
print(listing.price)
print(listing.formalised_address)
print(listing.daft_link)
```
## Documentation
The documentation has been created using [mkdocs](http://www.mkdocs.org/) and the [mkdocs material theme](https://squidfunk.github.io/mkdocs-material/). To update the documentation, clone the repository and edit the markdown files in the docs/ directory.
To view your changes, run:
``` bash
mkdocs serve
```
To build and publish the documentation, run:
``` bash
sh deploy_docs.sh "Updating documentation"
```
## Tests
The Python unittest module contains its own test discovery function, which you can run from the command line:
```
python -m unittest discover tests/
```
## 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.
Metadata
Release files for daftlistings 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| daftlistings-1.6.1.tar.gz | 12.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| daftlistings-1.6.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / daftlistings-1.6.1.tar.gz
| Download URL | daftlistings-1.6.1.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
895604ed5a6ee9c690734680ad9658dfc42a9b062b2cdc66e5fc689fc8220a57
|
|
BLAKE2b-256 checksum How to use checksums |
562f23a1337d912422b47a5a2ace9eb7afead5c658639fe503e84bd9c0444e22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.11.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.10
|
Release files / daftlistings-1.6.1-py2.py3-none-any.whl
| Download URL | daftlistings-1.6.1-py2.py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
825d81e41e63e85f8b47fcc4832a4ebbbf51001e5ac12adbca8affe6aca91414
|
|
BLAKE2b-256 checksum How to use checksums |
00aa5838f46fac931fd73626ae8124bec7e6d426973403ccc4f68955a732b5b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.11.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.10
|
Security for daftlistings 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.