Report client.get_profile() errors nicely (e.g. API key).

This patch is particularly useful in the scenario that your
API key is wrong or out of date, but it's targeted more
generally at any error that `client.get_profile()` reports.
This commit is contained in:
Steve Howell 2017-11-22 08:42:07 -08:00 committed by showell
parent 043d963a99
commit a32446f557

View file

@ -106,6 +106,13 @@ class ExternalBotHandler(object):
'''.format(e)) '''.format(e))
sys.exit(1) sys.exit(1)
if user_profile.get('result') == 'error':
msg = user_profile.get('msg', 'unknown')
print('''
ERROR: {}
'''.format(msg))
sys.exit(1)
self._rate_limit = RateLimit(20, 5) self._rate_limit = RateLimit(20, 5)
self._client = client self._client = client
self._root_dir = root_dir self._root_dir = root_dir