"""
Display Twitter Errors nicely
"""
+ data = twitterException.response_data
try:
- # twitterException.response_data can be byte string on Python 3
- # or nornal dict on Python 2
- loadedJson = json.loads(twitterException.response_data.decode('utf8'))
- for m in loadedJson.get('errors', dict()):
- info = "Error " + str(m.get('code')) + ": " + m.get('message')
- printNicely(yellow(info))
- except:
- info = "Error: " + twitterException.response_data.decode('utf8')
- printNicely(yellow(info))
+ for m in data.get('errors', dict()):
+ printNicely(yellow(m.get('message')))
+ except:
+ printNicely(yellow(data))
def format_prefix(listname='', keyword=''):