From 2ff78cfd4a7ff4a93eee5a82ae02e045ab6a7149 Mon Sep 17 00:00:00 2001 From: lomion Date: Sat, 3 Jul 2021 09:29:08 +0200 Subject: [PATCH] Working --- aiphttp_tester.py | 13 +++++++++++++ tmdb/tmdb_api.py | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 aiphttp_tester.py diff --git a/aiphttp_tester.py b/aiphttp_tester.py new file mode 100644 index 0000000..bad9709 --- /dev/null +++ b/aiphttp_tester.py @@ -0,0 +1,13 @@ +from tmdb.tmdb_api import Movie +import asyncio +import time + +async def test(): + start = time.time() + movie = Movie() + await movie.load_parameters() + id = await movie.search_title('Breakfast Club') + print(time.time() - start) + await movie.close_session() + +asyncio.run(test()) diff --git a/tmdb/tmdb_api.py b/tmdb/tmdb_api.py index 46537d0..8edc35c 100644 --- a/tmdb/tmdb_api.py +++ b/tmdb/tmdb_api.py @@ -124,10 +124,10 @@ class Movie(TmdbApiSingle): json = await self.request('search/movie', params=payload) if json['total_results'] > 0: movie_id = json['results'][0]['id'] - #await asyncio.gather( - await self.query_details(movie_id) - await self.query_cast(movie_id) - #) + await asyncio.gather( + self.query_details(movie_id), + self.query_cast(movie_id) + ) return movie_id async def query_details(self, id):