VikParuchuri / apartment-finder

A Slack bot that helps you find an apartment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

External Config

jelling opened this issue · comments

I can't get the project to load the external config file but everything else works, including posting to my Slack channel.

My config is at ~/.aptfinder/config/private.py. I've also tried putting it at ~/.aptfinder/private.py

I'm running docker w/ this command:

docker run -d -e SLACK_TOKEN={mytoken} -v /Users/jelling/.aptfinder:/opt/wwc/apartment-finder/config dataquestio/apartment-finder

Any ideas? I see no problems when running docker in interactive mode.

Per the Readme, I did a "docker exec -it {YOUR_CONTAINER_ID} /bin/bash" into the container and verified that the config directory is reading from my host config directory and that private.py is visible.

I also compiled private.py to make certain there weren't any syntax errors in the file.

Your docker run command should point to the config directory not the project root directory.

So something like:

docker run -d -e SLACK_TOKEN={mytoken} -v /Users/jelling/.aptfinder/config:/opt/wwc/apartment-finder/config dataquestio/apartment-finder

Thanks for the response but /Users/jelling/.aptfinder is not the project root directory. I'm on OSX if I matters.

What does cat /opt/wwc/logs/afinder.log show in the docker container?

The only thing in the log is a couple of these:
/usr/local/lib/python3.4/dist-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser fo r this system ("html5lib"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a d ifferent parser and behave differently.

Since it scrapes properly with the default values I presume this is not a problem.

Is there a known good private.py I can reference?

Interestingly, a pycache file is created for my private.py when I run the program. This indicates to me it's being properly imported and compiled when I start the docker container.

This is what mine looks like, located under config/private.py and it seems to be working alright.

MIN_PRICE = 1000
MAX_PRICE = 1800
CRAIGSLIST_SITE = '<mycity>'
AREAS = [""] #important to have this if you are not selecting any areas
BOXES = {
    "centretown": [
        [<lat>,<long>],
        [<lat>, <long>]
    ]
}
NEIGHBORHOODS = []
MAX_TRANSIT_DIST = 2 # kilometers
TRANSIT_STATIONS = {}
CRAIGSLIST_HOUSING_SECTION = 'apa'
SLEEP_INTERVAL = 20 * 60 # 20 minutes
SLACK_CHANNEL = "#housing"
SLACK_TOKEN = "<my-token>"