class Collection( Element ): id = Datapoint('id', initarg=1) name = Datapoint('name') backdrop = Datapoint('backdrop_path', handler=Backdrop, raw=False) poster = Datapoint('poster_path', handler=Poster, raw=False) members = Datalist('parts', handler=Movie, sort='releasedate') def _populate(self): return Request('collection/{0}'.format(self.id), language=self._lang) def __repr__(self): return u"<{0.__class__.__name__} '{0.name}'>".format(self).encode('utf-8') return u"<{0} {1}>".format(self.__class__.__name__, s).encode('utf-8') if __name__ == '__main__': set_key('c27cb71cff5bd76e1a7a009380562c62') #MythTV API Key DEBUG = True banner = 'tmdb_api interactive shell.' import code try: import readline, rlcompleter except: pass else: readline.parse_and_bind("tab: complete") banner += ' TAB completion available.' namespace = globals().copy() namespace.update(locals()) code.InteractiveConsole(namespace).interact(banner)
class Collection(Element): id = Datapoint('id', initarg=1) name = Datapoint('name') backdrop = Datapoint('backdrop_path', handler=Backdrop, raw=False) poster = Datapoint('poster_path', handler=Poster, raw=False) members = Datalist('parts', handler=Movie) def _populate(self): return Request('collection/{0}'.format(self.id)).readJSON() Movie.collection.sethandler(Collection) if __name__ == '__main__': set_key('c27cb71cff5bd76e1a7a009380562c62') # DEBUG = True banner = 'tmdb_api interactive shell.' import code try: import readline, rlcompleter except: pass else: readline.parse_and_bind("tab: complete") banner += ' TAB completion available.' namespace = globals().copy() namespace.update(locals()) code.InteractiveConsole(namespace).interact(banner)
class Collection( Element ): id = Datapoint('id', initarg=1) name = Datapoint('name') backdrop = Datapoint('backdrop_path', handler=Backdrop, raw=False) poster = Datapoint('poster_path', handler=Poster, raw=False) members = Datalist('parts', handler=Movie) def _populate(self): return Request('collection/{0}'.format(self.id)).readJSON() def __repr__(self): return u"<{0.__class__.__name__} '{0.name}'>".format(self).encode('utf-8') return u"<{0} {1}>".format(self.__class__.__name__, s).encode('utf-8') if __name__ == '__main__': set_key('c27cb71cff5bd76e1a7a009380562c62') DEBUG = False banner = 'tmdb_api interactive shell.' import code try: import readline, rlcompleter except: pass else: readline.parse_and_bind("tab: complete") banner += ' TAB completion available.' namespace = globals().copy() namespace.update(locals()) code.InteractiveConsole(namespace).interact(banner)