本文整理汇总了Python中pytvdbapi.api.TVDB.search方法的典型用法代码示例。如果您正苦于以下问题:Python TVDB.search方法的具体用法?Python TVDB.search怎么用?Python TVDB.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pytvdbapi.api.TVDB
的用法示例。
在下文中一共展示了TVDB.search方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_unicode_search
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_unicode_search(self):
"""
It should be possible to search for shows containing non ascii chars
"""
api = TVDB("B43FF87DE395DF56")
search = api.search("Alarm für cobra 11", "de")
show = search[0]
self.assertEqual(show[1][2].EpisodeName, "Rote Rosen, schwarzer Tod")
search = api.search('3年B組金八先生', "zh")
show = search[0]
self.assertEqual(show[1][1].EpisodeName, "3年B組金八先生")
示例2: test_search
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_search(self):
"""It should be possible to search for shows"""
api = TVDB("B43FF87DE395DF56")
search = api.search("dexter", "en")
self.assertEqual(len(search), 1)
search = api.search("scrubs", "en")
self.assertEqual(len(search), 2)
search = api.search("dexter", "en")
self.assertEqual(len(search), 1)
self.assertEqual(search.search, "dexter")
示例3: test_iterate_search
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_iterate_search(self):
"""It should be possible to iterate over a search result"""
api = TVDB("B43FF87DE395DF56")
search = api.search("house", "en")
for s in search:
self.assertEqual(type(s), pytvdbapi.api.Show)
示例4: test_force_language
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_force_language(self):
"""
It should be possible to use the "force_lang" keyword when
creating the TVDB instance
"""
api = TVDB("B43FF87DE395DF56", force_lang=True)
search = api.search("dexter", "it")
self.assertEqual(len(search), 2)
示例5: test_invalid_search_index
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_invalid_search_index(self):
"""Search should raise TVDBIndexError when trying to access an
invalid index
"""
api = TVDB("B43FF87DE395DF56")
search = api.search("dexter", "en")
self.assertRaises(error.TVDBIndexError, search.__getitem__, 2)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 5)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 100)
self.assertRaises(error.TVDBIndexError, search.__getitem__, "foo")
示例6: test_attribute_case
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_attribute_case(self):
"""
When ignore_case is False, all attributes should be case sensitive
"""
api = TVDB("B43FF87DE395DF56", ignore_case=False)
search = api.search("friends", 'en')
# Load and update the show
show = search[0]
show.update()
self.assertRaises(error.TVDBAttributeError, show.__getattr__, "ImDB_id")
示例7: test_ignore_case
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_ignore_case(self):
"""
It should be possible to pass the ignore_case keyword to the api
and access all show/season/episode attributes in a case insensitive
way.
"""
api = TVDB("B43FF87DE395DF56", ignore_case=True)
search = api.search("friends", 'en')
# Load and update the show
show = search[0]
show.update()
self.assertEqual(show.IMDB_ID, show.imdb_id)
self.assertEqual(show.ImDB_id, show.imDb_Id)
示例8: test_names_with_spaces
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_names_with_spaces(self):
"""It should be possible to search for shows with spaces in the name"""
api = TVDB("B43FF87DE395DF56")
search = api.search("How I Met Your Mother", "en")
self.assertEqual(len(search), 1)
示例9: test_case_insensitive
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def test_case_insensitive(self):
"""The test should be case insensitive"""
api = TVDB("B43FF87DE395DF56")
search = api.search("DeXtEr", "en")
self.assertEqual(len(search), 1)
示例10: _load_show
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def _load_show(show):
"""Helper function to load a show show from server"""
api = TVDB("B43FF87DE395DF56")
search = api.search(show, "en")
return search[0]
示例11: get
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import search [as 别名]
def get(self, language, name):
db = TVDB(tvdb_api_key)
shows = db.search(name, language)
shows = [show_to_dict(show) for show in shows]
data = {"status": "success", "data": shows}
self.write(data)