Update README.rst
[rainbowstream.git] / rainbowstream / util.py
CommitLineData
5531923e
LP
1import json
2
3from twitter.util import printNicely
8daad13d 4from .colors import *
5531923e
LP
5
6
7def printTwitterErrors(twitterException):
8daad13d 8 """
9 Display Twitter Errors nicely
10 """
5531923e
LP
11 try:
12 loadedJson = json.loads(twitterException.response_data)
13 for m in loadedJson.get('errors', dict()):
14 printNicely(
15 magenta("Error " + str(m.get('code')) + ": " + m.get('message')))
16 except ValueError:
8daad13d 17 printNicely(magenta("Error: " + twitterException.response_data))