Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
allow bedroom configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
echentw committed Aug 8, 2019
1 parent 0a5eee2 commit e107031
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,17 @@ def scrape_area(area):
:param area:
:return: A list of results.
"""
cl_h = CraigslistHousing(site=settings.CRAIGSLIST_SITE, area=area, category=settings.CRAIGSLIST_HOUSING_SECTION,
filters={'max_price': settings.MAX_PRICE, "min_price": settings.MIN_PRICE})
cl_h = CraigslistHousing(
site=settings.CRAIGSLIST_SITE,
area=area,
category=settings.CRAIGSLIST_HOUSING_SECTION,
filters={
'max_price': settings.MAX_PRICE,
'min_price': settings.MIN_PRICE,
'min_bedrooms': settings.MIN_BEDROOMS,
'max_bedrooms': settings.MAX_BEDROOMS,
}
)

results = []
gen = cl_h.get_results(sort_by='newest', geotagged=True, limit=20)
Expand Down
4 changes: 4 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
# The maximum rent you want to pay per month.
MAX_PRICE = 2000

# The minimum and maximum number of bedrooms you want.
MIN_BEDROOMS = 1
MAX_BEDROOMS = 4

## Location preferences

# The Craigslist site you want to search on.
Expand Down

0 comments on commit e107031

Please sign in to comment.