changeset d6da2a56d015 in tryton-tweet:default
details: https://hg.tryton.org/tryton-tweet?cmd=changeset;node=d6da2a56d015
description:
        Add success stories

        review281881002
diffstat:

 README          |  16 ++++++++--------
 success-stories |  14 ++++++++++++++
 tweet           |  15 ++++++++++-----
 3 files changed, 32 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r fde74f132c39 -r d6da2a56d015 README
--- a/README    Wed Mar 27 09:06:10 2019 +0100
+++ b/README    Thu Jul 18 09:45:33 2019 +0200
@@ -1,10 +1,10 @@
-===========
-Tryton Tips
-===========
+=============
+Tryton Tweets
+=============
 
-A collection of tips about Tryton, each tip is separated by one empty line.
+A collection of tweets about Tryton, each tweet is separated by one empty line.
 
-The script `tweet` tweets one random tips. It requires a configuration file in
-the same directory named `twitter.cfg` which contains the credentials to the
-Twitter account. The file is composed of two sections `consumer` and
-`access_token` with each one the two values `key` and `secret`.
+The script `tweet` tweets one random tip or success-story. It requires a
+configuration file in the same directory named `twitter.cfg` which contains the
+credentials to the Twitter account. The file is composed of two sections
+`consumer` and `access_token` each containing the two values `key` and 
`secret`.
diff -r fde74f132c39 -r d6da2a56d015 success-stories
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/success-stories   Thu Jul 18 09:45:33 2019 +0200
@@ -0,0 +1,14 @@
+Check how Expertise Vision has structured their purchasing process thanks to 
#Tryton
+https://www.tryton.org/success-stories/expertise-vision
+
+See how #Tryton helped Grufesa to export berries to countries around the world
+https://www.tryton.org/success-stories/grufesa
+
+Thank to #Tryton the Swiss ALS society's donation management has significantly 
improved
+https://www.tryton.org/success-stories/als-swiss
+
+#Tryton can handle the huge amount of invoices Felber has to process
+https://www.tryton.org/success-stories/felber
+
+Here's how #Tryton helped to structure BLUE BOX Distribution's business 
processes
+https://www.tryton.org/success-stories/blue-box-distribution
diff -r fde74f132c39 -r d6da2a56d015 tweet
--- a/tweet     Wed Mar 27 09:06:10 2019 +0100
+++ b/tweet     Thu Jul 18 09:45:33 2019 +0200
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 import os
 import configparser
+import sys
 from itertools import groupby
 from random import choice
 
@@ -13,13 +14,17 @@
     return line == '\n'
 
 
-tips = []
-with open(os.path.join(curdir, 'tips'), 'r') as fp:
+data, prefix = {
+    'tip': ('tips', "#TrytonTips"),
+    'success-story': ('success-stories', ""),
+    }[sys.argv[1]]
+tweets = []
+with open(os.path.join(curdir, data), 'r') as fp:
     for key, lines in groupby(fp, block_separator):
         if key:
             continue
-        tips.append(' '.join(map(str.strip, lines)))
-tip = '#TrytonTips: %s' % choice(tips)
+        tweets.append(prefix + ' '.join(map(str.strip, lines)))
+tweet = choice(tweets)
 
 config = configparser.ConfigParser()
 config.read(os.path.join(curdir, 'twitter.cfg'))
@@ -29,4 +34,4 @@
     consumer_secret=config.get('consumer', 'secret'),
     access_token_key=config.get('access_token', 'key'),
     access_token_secret=config.get('access_token', 'secret')
-    ).PostUpdate(tip)
+    ).PostUpdate(tweet)

Reply via email to