Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Docs for config values for fedmsg-tweet.

  • Loading branch information...
commit 37a6f1ffdc982a7e1180ecb2ae0799821d6d2a1e 1 parent 7593310
Ralph Bean authored
4  doc/commands.rst
Source Rendered
@@ -37,6 +37,10 @@ fedmsg-irc
37 37
 ~~~~~~~~~~
38 38
 .. autofunction:: fedmsg.commands.ircbot.ircbot
39 39
 
  40
+fedmsg-tweet
  41
+~~~~~~~~~~
  42
+.. autofunction:: fedmsg.commands.tweet.tweet
  43
+
40 44
 fedmsg-gateway
41 45
 ~~~~~~~~~~~~~~
42 46
 .. autofunction:: fedmsg.commands.gateway.gateway
60  doc/config.rst
Source Rendered
@@ -248,6 +248,66 @@ Glossary of Configuration Values
248 248
         body will be discarded and not echoed into ``#fedora-fedmsg``.  This is
249 249
         an area that could use some improvement.
250 250
 
  251
+    tweet_endpoints
  252
+        ``list`` - A list of twitter/statusnet configuration dicts.  This is the
  253
+        primary way of configuring the ``fedmsg-tweet`` bot implemented in
  254
+        :func:`fedmsg.commands.tweet.tweet`.
  255
+
  256
+        Each dict contains a number of possible options.  Take the following
  257
+        example:
  258
+
  259
+          >>> tweet_endpoints=[
  260
+          ...     tweet_settings=dict(
  261
+          ...         base_url="http://api.twitter.com",
  262
+          ...         consumer_key="123456789ABCDEF",
  263
+          ...         consumer_secret="123456789ABCDEF",
  264
+          ...         access_token_key="12345678ABCDEF",
  265
+          ...         access_token_secret="1234567ABCDEF",
  266
+          ...     ),
  267
+          ...     dict(
  268
+          ...         base_url="http://identi.ca/api",
  269
+          ...         consumer_key="12345676ABCDEF",
  270
+          ...         consumer_secret="12345678ABCDEF",
  271
+          ...         access_token_key="12355ABCEEF",
  272
+          ...         access_token_secret="123456ABCDEF",
  273
+          ...     ),
  274
+          ... ],
  275
+
  276
+        The ``base_url`` entry specifies which service to use.  The other
  277
+        options are all oauth credentials.
  278
+
  279
+        See https://dev.twitter.com/docs/auth/tokens-devtwittercom about getting
  280
+        credentials for twitter.com.  You can get all four authn values from
  281
+        their site.
  282
+
  283
+        Statusnet is a bit more tricky.  You'll need to get your
  284
+        ``consumer_key`` and ``consumer_secret`` yourself from http://identi.ca/
  285
+        and then perform the "oauth dance" with `this python script
  286
+        <https://gist.github.com/4070630>`_ in order to get your
  287
+        ``access_token_key`` and ``access_token_secret``.
  288
+
  289
+    bitly_settings
  290
+        ``dict`` - A dictionary containing credentials to shorten links against
  291
+        http://bit.ly/.  It must contain values for ``api_user`` and ``api_key``
  292
+        which can be obtained from http://bit.ly/
  293
+
  294
+        This is used primarily for :func:`fedmsg.commands.tweet.tweet` but could
  295
+        in theory be used elsewhere (like in
  296
+        :func:`fedmsg.commands.ircbot.ircbot`)
  297
+
  298
+    tweet_hibernate_duration
  299
+        ``float`` - A number of seconds that :func:`fedmsg.commands.tweet.tweet`
  300
+        should go to sleep if it encounters a rate limit error from either
  301
+        statusnet or twitter.com.  Set this relatively high, multiple minutes
  302
+        (120 or 180) since you don't want to exhaust your allowance.
  303
+        There is a daily limit of 1,000 messages.  See http://bit.ly/W6agqr
  304
+        for more information.
  305
+
  306
+    tweet_intermessage_pause
  307
+        ``float`` - A number of seconds that :func:`fedmsg.commands.tweet.tweet`
  308
+        should go to sleep inbetween every message it posts.  Set this
  309
+        relatively low to 0.5 or 1.
  310
+
251 311
     zmq_enabled
252 312
         ``bool`` - A value that must be true.  It is present solely
253 313
         for compatibility/interoperability with `moksha
15  fedmsg/commands/tweet.py
@@ -30,7 +30,20 @@
30 30
 
31 31
 @command(name="fedmsg-tweet", extra_args=[], daemonizable=True)
32 32
 def tweet(**kw):
33  
-    """ Rebroadcast messages to twitter """
  33
+    """ Rebroadcast messages to twitter and statusnet
  34
+
  35
+    New values in the fedmsg configuration are needed for this to work.  Lists
  36
+    and dicts of authentication credentials such as:
  37
+
  38
+        - :term:`tweet_endpoints`
  39
+        - :term:`bitly_settings`
  40
+
  41
+    And scalars to help with rate limiting such as:
  42
+
  43
+        - :term:`tweet_hibernate_duration`
  44
+        - :term:`tweet_intermessage_pause`
  45
+
  46
+    """
34 47
 
35 48
     # First, sanity checking.
36 49
     if not kw.get('tweet_endpoints', None):

0 notes on commit 37a6f1f

Please sign in to comment.
Something went wrong with that request. Please try again.