Skip to content
Get a random tweet from Twitter based on an input keyword.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
random_tweet
tests Some additional comments. Removal of geocode feature. Added some init… Feb 25, 2016
.gitignore Initial tracer bullet. load credentials from local file, get bearer t… Feb 23, 2016
LICENSE Initial commit Feb 22, 2016
README.md Some additional comments. Removal of geocode feature. Added some init… Feb 25, 2016
credentials.dist
random_tweet.py Some additional comments. Removal of geocode feature. Added some init… Feb 25, 2016
requirements.txt
run_tests.sh

README.md

random-tweet

Get a random tweet from Twitter based on an input keyword.

Prerequisites:

  • Python 3.x (developed on 3.4.3+)
  • httplib2==0.9.2
  • requests==2.9.1
  • urllib3==1.14
  • File named "credentials" in same directory, containing twitter key & secret separated by line break (\n)

Use pip install -r requirements.txt to install dependencies.

Example credentials file:

anbckdfiiettddv
NBD120fkdfipODeffNBDf334kdfipODe554ff

Visit https://apps.twitter.com/ to get your API key and secret strings.

Usage:

python random_tweet.py <search_term>

Example:

python random_tweet.py apple

Example Output:

@username_here: An apple a day #try2 #crashed (@ 11 Penn Plaza in New York, NY) https://t.co/yyy https://t.co/zzz
media: https://pbs.twimg.com/media/Cb1eILsWAAAXmDj.jpg

Tests

To run basic tests,

./run_tests.sh

License

MIT License

You can’t perform that action at this time.