Skip to content

Client Twitter

Keith Sterling edited this page Feb 26, 2019 · 5 revisions

Overview

The curent Twitter client uses a polling mechanism as provided by the Python package tweepy, it is envisaged in the future that this will have streaming added to it. This is in the backlog and is likely to make it into a 1.x release

Running the Client

The client is derived from the following Python class

    programy.clients.twitter.TwitterBotClient

To run the Facebook client, you can use the shell script in Y-Bot scripts folder

./y-bot-twitter.sh

Or you can use the command line

python3 -m programy.clients.polling.twitter.client --config <PATH TO CONFIG> --cformat yaml --logging <PATH TO LOGGING>

The configuration settings can be found in the wiki page Twitter Configuration.

License Key Settings

In addition to configuration settings, there are a number of Twitter-specific license keys. These are stored in license.keys in the /config file. However, for security reasons, this file is excluded from Github and you'll need to create your own with the following settings

    TWITTER_USERNAME = programybot
    TWITTER_CONSUMER_KEY = xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TWITTER_CONSUMER_SECRET = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TWITTER_ACCESS_TOKEN = xxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    TWITTER_ACCESS_TOKEN_SECRET = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Permissions

These keys and secrets come from registering as a developer on Twitter, creating an app and then following the instructions to create Consumer And Access tokens and secrets. Please note that a Bot needs specific permissions, so please make sure that you set the access to 'Read, Write and Access direct messages'

What type of access does your application need?
Read only
Read and Write << default
Read, Write and Access direct messages << needed!
Clone this wiki locally