Exemplo n.º 1
0
 def __init__(self, apikey = '', output = 'json'):
     if apikey:
         self.apikey = apikey
     
     self.urls = TMDBUrls()
     
     connection = connect()
Exemplo n.º 2
0
            try:
                if member['job'] == 'Actor':
                    actors.append(member['name'])
            except KeyError:
                pass
        return '     '.join(actors[:3])
    
    def _getResponse(self, url):
        try:
            self._server_response = urlopen(url)
        except HTTPError:
            print "Couldn't open:", url
            sys.exit(3)

        self._server_msg = self._server_response.msg
        if "OK" not in self._server_msg:
            raise TMDBNotFoundError
        else:
            self._response_data = json.loads(self._server_response.read())[0]
            if "Nothing found" in self._response_data:
                raise TMDBNotFoundError
            else:
                return self._response_data
        
if __name__ == '__main__':
    connect()
    t = TMDB()
    this_id = t.getMovieIDByName('Aliens')
    print "ID: ", this_id
    this_movie = t.getMovieInfoByTMDB_ID(this_id)
    print this_movie.toxml()