Documentation for the Retweet project¶
You’ll find below anything you need to install, configure or run Retweet.
Guide¶
How to install Retweet¶
From PyPI¶
$ pip3 install retweet
From sources¶
You need at least Python 3.4.
On some Linux Distribution setuptools package does not come with default python install, you need to install it.
Install PIP:
$ wget https://bootstrap.pypa.io/get-pip.py -O - | sudo python3
Install setuptools module:
$ wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python3
(Alternatively, Setuptools may be installed to a user-local path):
$ wget https://bootstrap.pypa.io/ez_setup.py -O - | python3 - --user
Untar the tarball and go to the source directory with the following commands:
$ tar zxvf retweet-0.10.tar.gz $ cd retweet
Next, to install Retweet on your computer, type the following command with the root user:
$ python3 setup.py install $ # or $ python3 setup.py install --install-scripts=/usr/bin
Configure Retweet¶
As a prerequisite to use Retweet, you need a Twitter app. Log in Twitter, go to https://apps.twitter.com, create an app and generate the access token.
In order to configure Retweet, you need to create a retweet.ini file (or any name you prefer, finishing with the extension .ini) with the following parameters:
[twitter]
screen_name_of_the_user_to_retweet=journalduhacker
consumer_key=ml9jaiBnf3pmU9uIrKNIxAr3v
consumer_secret=8Cmljklzerkhfer4hlj3ljl2hfvc123rezrfsdctpokaelzerp
access_token=213416590-jgJnrJG5gz132nzerl5zerwi0ahmnwkfJFN9nr3j
access_token_secret=3janlPMqDKlunJ4Hnr90k2bnfk3jfnwkFjeriFZERj32Z
[retweet]
retweets = 0
do_not_retweet_hashtags=dnr,
only_if_hashtags=python,
match=[Rr]egex
; only retweet tweets older than n minutes
older_than=60
; only retweet tweets younger than n minutes
younger_than=120
like=true
[sqlite]
sqlitepath=/var/lib/retweet/retweet.db
- screen_name_of_the_user_to_retweet: the screen_name of the user to retweet (in @carl_chenet, it’s carl_chenet)
- consumer_key: the Twitter consumer key (see your apps.twitter.com webpage)
- consumer_secret: the Twitter consumer secret key (see your apps.twitter.com webpage)
- access_token: the Twitter access token key (see your apps.twitter.com webpage)
- access_token_secret: the Twitter access token secret key (see your apps.twitter.com webpage)
- retweets: the minimal number of retweets the tweet needs to have in order we also retweet it
- waitminsecs: the minimal number of seconds to wait after processing a tweet
- waitmaxsecs: the maximal number of seconds to wait after processing a tweet
- sqlitepath: the path to the sqlite3 database file storing the already sent tweet ids
- do_not_retweet_hashtags: do not retweet if one of the hashtags in this list is in the text of the tweet
- only_if_hashtags: only retweet tweets having one of the hashtags of the list
- match: only retweet tweets containing given regular expression match
- older_than: only retweet tweets older than a number of minutes
- younger_than: only retweet tweets younger than a number of minutes
- like: like all the retweeted tweets
Use Retweet¶
After the configuration of Retweet, just launch the following command:
$ retweet /path/to/retweet.ini
Using the -l or –limit command line option, you can limit the retrieved statuses from Twitter:
$ retweet -l 12 /path/to/retweet.ini
Using the –dry-run command line option allows not retweeting the tweets and not feed local SQLite database, for testing purpose:
$ retweet --dry-run /path/to/retweet.ini
License¶
This software comes under the terms of the GPLv3+. See the LICENSE file for the complete text of the license.
Authors¶
Carl Chenet <chaica@ohmytux.com>