VikParuchuri / apartment-finder
- понедельник, 29 августа 2016 г. в 03:12:59
Python
A Slack bot that helps you find an apartment.
This repo contains the code for a bot that will scrape Craigslist for real-time listings matching specific criteria, then alert you in Slack. This will let you quickly see the best new listings, and contact the owners. You can adjust the settings to change your price range, what neighborhoods you want to look in, and what transit stations and other points of interest you'd like to be close to.
I successfully used this tool to find an apartment when I moved from Boston to SF. It saved a good amount of time and money. Read more about it here.
It's recommended to follow the Docker installation and usage instructions.
Look in settings.py
for a full list of all the configuration options. Here's a high level overview:
MIN_PRICE
-- the minimum listing price you want to search for.MAX_PRICE
-- the minimum listing price you want to search for.CRAIGSLIST_SITE
-- the regional Craigslist site you want to search in.AREAS
-- a list of areas of the regional Craiglist site that you want to search in.BOXES
-- coordinate boxes of the neighborhoods you want to look in.NEIGHBORHOODS
-- if the listing doesn't have coordinates, a list of neighborhoods to match on.MAX_TRANSIT_DISTANCE
-- the farthest you want to be from a transit station.TRANSIT_STATIONS
-- the coordinates of transit stations.CRAIGSLIST_HOUSING_SECTION
-- the subsection of Craigslist housing that you want to look in.SLACK_CHANNEL
-- the Slack channel you want the bot to post in.Before using this bot, you'll need a Slack team, a channel for the bot to post into, and a Slack API key:
#housing
as the name of the channel.config
, then put a file called private.py
inside.private.py
.
AREAS = ['sfc']
in private.py
to only look in San Francisco.housing
, add an entry for SLACK_CHANNEL
.CRAIGSLIST_SITE
AREAS
BOXES
NEIGHBORHOODS
TRANSIT_STATIONS
CRAIGSLIST_HOUSING_SECTION
MIN_PRICE
MAX_PRICE
private.py
in this folder.
SLACK_TOKEN
that contains your Slack API token.private.py
.docker run -d -e SLACK_TOKEN={YOUR_SLACK_TOKEN} dataquestio/apartment-finder
docker run -d -e SLACK_TOKEN={YOUR_SLACK_TOKEN} -v {ABSOLUTE_PATH_TO_YOUR_CONFIG_FOLDER}:/opt/wwc/apartment-finder/config dataquestio/apartment-finder
Dockerfile
, and make sure you install any of the apt packages listed there.pip install -r requirements.txt
.python main_loop.py
.docker ps
to get the id of the container running the bot.docker exec -it {YOUR_CONTAINER_ID} /bin/bash
to get a command shell inside the container.sqlite listings.db
to run the sqlite command line tool and inspect the database state (the only table is also called listings
).
select * from listings
will get all of the stored listings.tail -f -n 1000 /opt/wwc/logs/afinder.log
.listings.db
to ensure listings are being added.