def get_orgs(intent, session):
session_attributes = {}
reprompt_text = None
should_end_session = True
g = Github(session['user']['accessToken'])
orgs = g.get_user().get_orgs()
num_orgs = 0
org_strings = []
for org in orgs:
num_orgs += 1
org_strings.append(org.url[org.url.rfind('/')+1:])
if num_orgs > 0:
speech_output = \
'You belong to these organizations. ' + ','.join(org_strings)
else:
speech_output = "You don't have any organizations in this account."
return build_response(session_attributes, build_speechlet_response(
intent['name'], speech_output, reprompt_text, should_end_session))
评论列表
文章目录