The code powering @eleanorrigbot.
See the tracking issue in my About repository.
Eleanor Rigbot, searching for tweets
That will fit in the scheme of this rhyme
What will it find?
You can install and launch the application using:
python setup.py install python launch_rigbot.py
or cf push
it to Cloud Foundry using the manifest.yml
file.
The following environment variables must be set to authenticate with the Twitter
API (e.g. using cf set-env <app> <var> <value>
):
TWITTER_API_KEY
TWITTER_API_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
See the Tweepy Authentication tutorial for more information.
For additional configuration, you can pass arguments to the launch script:
usage: launch_rigbot.py [-h] [--verbose] [--location SW_LON SW_LAT NE_LON NE_LAT] [--version] optional arguments: -h, --help show this help message and exit --verbose, -v set the logging level to DEBUG for more output --location SW_LON SW_LAT NE_LON NE_LAT, -l SW_LON SW_LAT NE_LON NE_LAT specify a location to filter (defaults to Liverpool) --version show program's version number and exit
To install for development, install the package and all of its requirements with:
pip install -r requirements.txt python setup.py develop
You can run the tests with:
python setup.py test
If you would like to match a different phrase, you can use the PhraseMatcher
to create an alternate matcher. For example:
# https://www.flickr.com/places/info/12591829
napoli = [13.8509, 40.5360, 14.6697, 41.0201]
# "when the moon hits your eye like a big pizza pie"
that_is_amore = PhraseMatcher((3, 3, 3, 3), (None, 'a', None, 'a'))
start_listening(napoli, that_is_amore)