rsudp.c_tweet (Twitter alerts)

class rsudp.c_tweet.Tweeter(consumer_key, consumer_secret, access_token, access_token_secret, q=False, tweet_images=False, extra_text=False, testing=False)

New in version 1.0.2: The option to add extra text to tweets using the "extra_text" setting in settings files built by this version and later.

Twitter is a social media platform sometimes used for quickly distributing public alert information. It is used by many agencies including Raspberry Shake, USGS, and EMSC.

Note

Twitter is more difficult and stricter when it comes to making API bots than many services. First, you must go through a relatively rigorous process of applying for a developer account, then making a Twitter “app”, and then giving the app permission to post on your behalf. See Setting up Twitter Apps for details.

Once you’ve gone through that process, Twitter limits posting and makes its rules on rate limiting relatively difficult to nail down. Generally, the early 2020 rate limit for posting is 300 in a 3-hour span, however that can vary depending on whether or not Twitter thinks there is suspicious activity coming from your account.

In general, if you are looking for a simple multi-platform notification service, it may be easier and more reliable to use the Telegram service instead. rsudp has a telegram module at rsudp.c_telegram.Telegram. See Setting up a Telegram Bot for details.

Parameters:
  • consumer_key (str) – Twitter calls this the “consumer key”
  • consumer_secret (str) – Twitter calls this the “consumer key secret”
  • access_token (str) – Twitter calls this the “consumer access token”
  • access_secret (str) – Twitter calls this the “consumer access secret”
  • tweet_images (bool) – whether or not to send images. if False, only alerts will be sent.
  • extra_text (bool or str) – 103 additional characters to post as part of the twitter message (longer messages will be truncated).
  • q (queue.Queue) – queue of data and messages sent by rsudp.c_consumer.Consumer
run()

Reads data from the queue and tweets a message if it sees an ALARM or IMGPATH message


Back to top ↑