/twedis

Dump images from twitter into redis

Primary LanguagePython

Purpose

This code uses the Twitter API to gather image URLs from returned tweets into Redis. The images are really the fun part, after all. The trump tracker is an example of its usage.

Setting up twitter streaming

Install dependencies

pip install -r requirements.txt

Set up Twitter API keys

export TWITTER_CONSUMER_KEY=yourkey
export TWITTER_CONSUMER_SECRET=yoursecret
export TWITTER_ACCESS_TOKEN=yourtoken
export TWITTER_ACCESS_SECRET=anothersecretyouhave

Install Redis on your Mac, since you're using a Mac after all

brew install redis
redis-server

Set up ENV vars to connect to Redis

export REDIS_HOST=localhost
export REDIS_PORT=6379
export REDIS_PASSWORD=blah

Optional: You can use the data module to dump some data into Postgres. (The python postgres module is NOT in requirements.txt)

createdb twedis
psql twedis < schema.sql

Usage

python twedis.py 'donald trump' 'kanye west' 'chicken nuggets'

Setting up web server

Install Grunt, Node, etc.

  1. Follow the setup instructions here
  2. Run grunt to compile the CSS

Run Flask

python application.py