def test_dict_obj_pop(self): dict_obj = AsObj(**self.entries) pop = dict_obj.pop('title') self.assertNotIn('title', dict_obj) self.assertEqual(pop, 'images') pop = dict_obj.pop('random', 'noexist') self.assertEqual(pop, 'noexist')
def combined_credits(self, person_id): """ Get the movie and TV credits together in a single response. :return: """ return AsObj( **self._call(self._urls["combined_credits"] % str(person_id), ""))
def details(self, company_id): """ Get a companies details by id. :param company_id: int :return: """ return AsObj(**self._call(self._urls['details'] % str(company_id), ''))
def details(self, keyword_id): """ Get a keywords details by id. :param keyword_id: int :return: """ return AsObj(**self._call(self._urls["details"] % str(keyword_id), ""))
def images(self, movie_id): """ Get the images that belong to a movie. :param movie_id: :return: """ return AsObj(**self._call(self._urls['images'] % movie_id, ''))
def movie_credits(self, person_id): """ Get the movie credits for a person. :return: """ return AsObj(**self._call(self._urls["movie_credits"] % str(person_id), ""))
def details(self, person_id): """ Get the primary person details by id. :param person_id: int :return: """ return AsObj(**self._call(self._urls['details'] % str(person_id), ''))
def keywords(self, movie_id): """ Get the keywords associated to a movie. :param movie_id: :return: """ return AsObj(**self._call(self._urls['keywords'] % movie_id, ''))
def release_dates(self, movie_id): """ Get the release date along with the certification for a movie. :param movie_id: :return: """ return AsObj(**self._call(self._urls['release_dates'] % movie_id, ''))
def details(self, collection_id): """ Get collection details by id. :param collection_id: :return: """ return AsObj(**self._call(self._urls["details"] % str(collection_id), ""))
def tv_credits(self, person_id): """ Get the TV show credits for a person. :return: """ return AsObj(**self._call(self._urls["tv_credits"] % str(person_id), ""))
def details(self, network_id): """ Get a networks details by id. :param network_id: int :return: """ return AsObj(**self._call(self._urls["details"] % str(network_id), ""))
def external_ids(self, id): """ Get the external ids for a TV show. :param id: :return: """ return AsObj(**self._call(self._urls['external_ids'] % id, ''))
def credits(self, movie_id): """ Get the cast and crew for a movie. :param movie_id: :return: """ return AsObj(**self._call(self._urls["credits"] % movie_id, ""))
def images(self, collection_id): """ Get the images for a collection by id. :param collection_id: :return: """ return AsObj(**self._call(self._urls["images"] % str(collection_id), ""))
def images(self, person_id): """ Get the images for a person. :param person_id: int :return: """ return AsObj(**self._call(self._urls["images"] % str(person_id), ""))
def watch_providers(self, movie_id): """ Get the Watch Providers for a movie. :param movie_id: :return: """ return AsObj(**self._call(self._urls['watch_providers'] % movie_id, ''))
def details(self, show_id, append_to_response='videos,trailers,images,credits,translations'): """ Get the primary TV show details by id. :param show_id: :param append_to_response: :return: """ return AsObj(**self._call(self._urls['details'] % str(show_id), 'append_to_response=' + append_to_response))
def alternative_titles(self, movie_id, country=""): """ Get all of the alternative titles for a movie. :param movie_id: :param country: :return: """ return AsObj(**self._call(self._urls["alternative_titles"] % movie_id, "country=" + country))
def details(self, tv_id, season_num, episode_num, append_to_response="trailers,images,casts,translations"): return AsObj(**self._call( self._urls['details'] % (str(tv_id), str(season_num), str(episode_num)), "append_to_response=%s" % append_to_response))
def test_dict_obj__setitem__(self): dict_obj = AsObj() dict_obj['title'] = 'images' dict_obj['results'] = [{'path': 'img/'}] dict_obj['formats'] = ['.jpg'] dict_obj['langs'] = {'ES': 'es-ES'} self.assertEqual(dict_obj['title'], 'images') self.assertEqual(dict_obj['results'][0]['path'], 'img/') self.assertEqual(dict_obj['formats'][0], '.jpg') self.assertEqual(dict_obj['langs']['ES'], 'es-ES')
def details(self, person_id, append_to_response='videos,images'): """ Get the primary person details by id. :param append_to_response: str :param person_id: int :return: """ return AsObj(**self._call(self._urls['details'] % str(person_id), 'append_to_response=' + append_to_response))
def details(self, person_id, append_to_response="videos,images"): """ Get the primary person details by id. :param append_to_response: str :param person_id: int :return: """ return AsObj(**self._call( self._urls["details"] % str(person_id), "append_to_response=" + append_to_response, ))
def changes( self, season_id, append_to_response="append_to_response=trailers,images,casts,translations" ): """ Get the changes for a TV season. By default only the last 24 hours are returned. :param season_id: :return: """ return AsObj(**self._call(self._urls['changes'] % str(season_id), append_to_response))
def details( self, movie_id, append_to_response="append_to_response=trailers,images,casts,translations,keywords" ): """ Get the primary information about a movie. :param movie_id: :param append_to_response: :return: """ return AsObj(**self._call(self._urls['details'] % movie_id, append_to_response))
def changes( self, season_id, append_to_response="videos,trailers,images,casts,translations"): """ Get the changes for a TV season. By default only the last 24 hours are returned. :param append_to_response: str :param season_id: int :return: """ return AsObj(**self._call( self._urls["changes"] % str(season_id), "append_to_response=" + append_to_response, ))
def images(self, movie_id, include_image_language=""): """ Get the images that belong to a movie. Querying images with a language parameter will filter the results. If you want to include a fallback language (especially useful for backdrops) you can use the include_image_language parameter. This should be a comma seperated value like so: include_image_language=en,null. :param movie_id: :param include_image_language: :return: """ return AsObj( **self._call(self._urls['images'] % movie_id, "include_image_language=" + include_image_language))
def details( self, movie_id, append_to_response="videos,trailers,images,casts,translations,keywords,release_dates", ): """ Get the primary information about a movie. :param movie_id: :param append_to_response: :return: """ return AsObj(**self._call( self._urls["details"] % movie_id, "append_to_response=" + append_to_response, ))
def details( self, tv_id, season_num, append_to_response='videos,trailers,images,credits,translations'): """ Get the TV season details by id. :param tv_id: :param season_num: :param append_to_response: :return: """ return AsObj( **self._call(self._urls['details'] % (str(tv_id), str(season_num)), 'append_to_response=' + append_to_response))
def test_dict_obj_fromkeys(self): dict_obj = AsObj().fromkeys({'a', 'b'}) self.assertEqual(len(dict_obj), 2) self.assertTrue(hasattr(dict_obj, 'a')) self.assertTrue(hasattr(dict_obj, 'b')) for value in dict_obj.values(): self.assertIsNone(value) dict_obj = AsObj().fromkeys({'a', 'b'}, 1) self.assertEqual(len(dict_obj), 2) self.assertTrue(hasattr(dict_obj, 'a')) self.assertTrue(hasattr(dict_obj, 'b')) for value in dict_obj.values(): self.assertEqual(value, 1)