如何使用通过 TMDB API 检索到的一些数据?
这是功能:
class Movies(Core):
def __init__(self, title="", limit=False):
self.limit = limit
self.update_configuration()
title = self.escape(title)
self.movies = self.getJSON(config['urls']['movie.search'] % (title,str(1)))
pages = self.movies["total_pages"]
if not self.limit:
if int(pages) > 1: #
for i in range(2,int(pages)+1): # Thanks @tBuLi
self.movies["results"].extend(self.getJSON(config['urls']['movie.search'] % (title,str(i)))["results"])
def __iter__(self):
for i in self.movies["results"]:
yield Movie(i["id"])
def get_total_results(self):
if self.limit:
return len(self.movies["results"])
return self.movies["total_results"]
def iter_results(self):
for i in self.movies["results"]:
yield i
和电话:
def search_tmdb(title):
tmdb.configure(TMDB_KEY)
movie = tmdb.Movies(title,limit=True)
问题是,我如何查看和使用对象影片的结果?
我很抱歉这个可能很愚蠢的问题,但我现在正在接近 python