本文整理汇总了Python中API.API.match_search_term方法的典型用法代码示例。如果您正苦于以下问题:Python API.match_search_term方法的具体用法?Python API.match_search_term怎么用?Python API.match_search_term使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API.API
的用法示例。
在下文中一共展示了API.match_search_term方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: action_request
# 需要导入模块: from API import API [as 别名]
# 或者: from API.API import match_search_term [as 别名]
def action_request(self):
"""
Action a Search request.
"""
titles = API.match_search_term(self.str_input)
# titles = [Title('The Martian', 2015, 'movie')] # OMDb is down!!!
self.build_response(titles)
# set the message according to local rules
if len(self.response.avail_titles) == 0 and len(self.response.unavail_titles) > 0:
self.response.message = 'Unfortunately no titles matching your search are available to ' \
'stream. You might want to set up an alert, or read the FAQs.'
elif len(self.response.avail_titles) == 0 and len(self.response.unavail_titles) == 0:
self.response.message = "We couldn't find any titles matching '%s'." % self.str_input
elif len(self.response.avail_titles) > 0 and len(self.response.unavail_titles) == 0:
self.response.message = 'Great! All titles matching your search are available to stream!'
else:
self.response.message = 'Great! Some titles matching your search are available to stream!'