本文整理汇总了Python中messages.Messages.greeting方法的典型用法代码示例。如果您正苦于以下问题:Python Messages.greeting方法的具体用法?Python Messages.greeting怎么用?Python Messages.greeting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.Messages
的用法示例。
在下文中一共展示了Messages.greeting方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_program
# 需要导入模块: from messages import Messages [as 别名]
# 或者: from messages.Messages import greeting [as 别名]
def load_program():
# Load the top program from the server.
# TODO: Check again later if no program is loaded
try:
reqUrl = SERVER + "/programs?q=" + urllib2.quote('{"executed":false}')
print reqUrl
program = urllib2.urlopen(reqUrl)
program = program.read()
print "program retrieved"
print program
program = json.loads(program)
print "json parsed"
print program
program = program[0]
print "program from index"
print program
say("Program loaded")
# Load the user's Twitter bio if possible.
if program.has_key("twitterHandle"):
handle = program["twitterHandle"].replace("@", "")
bio = get_twitter_bio(program["twitterHandle"])
if bio:
say(Messages.greeting(program["twitterHandle"], bio))
else:
say(Messages.greeting(program["twitterHandle"]))
else:
say("say", "Oops, could not find twitter handle.")
return program
except Exception as e:
print "No program to load"
print e
return False