From 9e38891f4376bbe71f9e10d267fa5721e6e69194 Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Thu, 23 Oct 2014 13:20:47 +0900 Subject: [PATCH] trivival refactoring --- docs/conf.py | 4 ++-- docs/index.rst | 4 ++++ rainbowstream/rainbow.py | 11 +++++------ rainbowstream/util.py | 9 +++++---- setup.py | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bc74222..985bdd5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '1.1.7' +version = '1.1.8' # The full version, including alpha/beta/rc tags. -release = '1.1.7' +release = '1.1.8' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 76167ed..db6cc91 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,6 +13,10 @@ favorite … and much more fun directly from terminal. This package is built on the top of `Python Twitter Tool`_ and `Twitter API`_, can run on Python 2.7.x and 3.x . +Home page : http://www.rainbowstream.org/ + +Source code : https://github.com/DTVD/rainbowstream + Install ------- diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 2d1be92..206f84d 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -27,7 +27,7 @@ from .interactive import * from .c_image import * from .py3patch import * from .emoji import * -from .util import printTwitterErrors +from .util import * # Global values g = {} @@ -2071,8 +2071,8 @@ def stream(domain, args, name='Rainbow Stream'): except TwitterHTTPError as e: printNicely('') printNicely( - magenta("We have maximum connection problem with twitter'stream API right now :(")) - printTwitterErrors(e) + magenta("We have connection problem with twitter'stream API right now :(")) + detail_twitter_error(e) def fly(): @@ -2088,9 +2088,8 @@ def fly(): except TwitterHTTPError as e: printNicely('') printNicely( - magenta("We have connection problem with twitter'stream API right now :(")) - printTwitterErrors(e) - printNicely(magenta("Let's try again later.")) + magenta("We have connection problem with twitter'REST API right now :(")) + detail_twitter_error(e) save_history() sys.exit() # Proxy connection problem diff --git a/rainbowstream/util.py b/rainbowstream/util.py index 03eaf90..a3cd127 100644 --- a/rainbowstream/util.py +++ b/rainbowstream/util.py @@ -4,14 +4,15 @@ from twitter.util import printNicely from .colors import * -def printTwitterErrors(twitterException): +def detail_twitter_error(twitterException): """ Display Twitter Errors nicely """ try: loadedJson = json.loads(twitterException.response_data) for m in loadedJson.get('errors', dict()): - printNicely( - magenta("Error " + str(m.get('code')) + ": " + m.get('message'))) + info = "Error " + str(m.get('code')) + ": " + m.get('message') + printNicely(yellow(info)) except ValueError: - printNicely(magenta("Error: " + twitterException.response_data)) + info = "Error: " + twitterException.response_data + printNicely(yellow(info)) diff --git a/setup.py b/setup.py index 2bbc458..85973a7 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '1.1.7' +version = '1.1.8' # Require install_requires = [ -- 2.25.1