Skip to main content

Karlsruher Twitter Robot

Project description

@Karlsruher

  • is a robot on Twitter (Link)
  • retweets mentions from its followers when they apply some rules

Setup instructions

Prerequisites:

  • Python 3 environment (tested with 3.5 on Linux, 3.8.5 MacOS)
  • The Robot needs a home directory for its work
  • You need Twitter API credentials for your Robot

Install the latest release into your Python 3 library:

$ python3 -m pip install -U --user --pre karlsruher

Still in Beta mode: --pre and expect a moving target!

Create a home directory

You might want to use a different path here:

export ROBOT_HOME=$HOME/karlsruher
mkdir -p $ROBOT_HOME

Create auth.yaml credentials file

You want to enter your own credentials here:

export ROBOT_HOME=$HOME/karlsruher
cat >$ROBOT_HOME/auth.yaml <<EOF
# You must enter real credentials here:
twitter:
  consumer:
    key: 'YOUR-CONSUMER-KEY'
    secret: 'YOUR-CONSUMER-SECRET'
  access:"
    key: 'YOUR-ACCESS-KEY'
    secret: 'YOUR-ACCESS-SECRET'
EOF

Setup complete

First run

The Robot needs to fetch its followers and friends from Twitter regularly, run this initially and once per day:

export ROBOT_HOME=$HOME/karlsruher
karlsruher --home=$ROBOT_HOME -housekeeping

To just perfom the desired retweet feature, run this at any interval:

export ROBOT_HOME=$HOME/karlsruher
karlsruher --home=$ROBOT_HOME -retweet 

Crontab example:

*/5 * * * * karlsruher --home=ROBOT_HOME -retweet >>ROBOT_HOME/log 2>&1
3 3 * * *   karlsruher --home=ROBOT_HOME -housekeeping >>ROBOT_HOME/log 2>&1

Simple logfile rotation:

# cat /etc/logrotate.d/karlsruher
ROBOT_HOME/log {
        rotate 7
        daily
        compress
        missingok
        notifempty
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

karlsruher-3.0b2.tar.gz (11.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page