- 1 Overview
- 2 Download
- 3 Dependencies and Setup
- 3.1 Dependencies
- 3.2 Setup and Config
- 3.2.1 Twitter Application
- 3.2.2 locations.properties
- 3.2.3 pytwitservice.properties
- 3.2.4 Email Config Properties File
PyTwitService was originally designed to help with the administration of the @OlympicTrucks twitter account. PyTwitService parses a user’s timeline (i.e. tweets of all followers), searches for certain keywords, and RT’s the specific tweet if the tweet’s contents matches the expected criteria. This is run from a host computer and utilizes the Twitter REST API v.1.1 and utilizes OAuth for authentication.
Dependencies and Setup
- python-twitter — https://code.google.com/p/python-twitter/
- simplejson — http://cheeseshop.python.org/pypi/simplejson
- httplib2 — http://code.google.com/p/httplib2/
- python-oauth2 — http://github.com/simplegeo/python-oauth2
To install python-twitter, install simplejson, httplib2, and python-oauth2. Then, install python-twitter from source.
Setup and Config
You will need the following:
- Twitter Account (one that you wish to parse)
- Twitter Application (to access your Twitter Account)
- Consumer Key
- Consumer Secret
- Access Token Key
- Access Token Secret
There are several tutorials online on how to obtain these.
You can also utilize get_access_token.py located in your python-twitter source (python-twitter/get_access_token.py)
In your PyTwitService source, navigate to ../PyTwitService/config/locations.properties
This should be set to the location of the text file containing the consumer key value
This should be set to the location of the text file containing the consumer secret value
This should be set to the location of the text file containing the access token value
This should be set to the location of the text file containing the access token secret value
since_tweet_id, max_tweet_id, temp_max_tweet_id
These should be set to the locations of text files that will hold a tweet id. The directory should exist. The files themselves need not exist, but feel free to “touch” them to create a blank file.
This should be set to the location of the text files containing the user-set filters used to single out certain tweets in your timeline.
In your PyTwitService source, navigate to ../PyTwitService/config/pytwitservice.properties
This should be set to point to your email config properties file.
Email Config Properties File
The location and name of this file is set in your pytwitservice.properties file.
This is a “section” (see http://docs.python.org/2/library/configparser.html). This should be set to [default]
Set this to your “From” email address
Set this to your subscribers (who you are sending email to.) Separate by comma.
This is not used as of v.1.0.0
The password of your “From” email address.