Renamed aiphttp_tester.py to aiohttp_tester.py
Fixes flake
This commit is contained in:
parent
2ff78cfd4a
commit
aecf52a095
|
@ -2,11 +2,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("ID of Breakfast Club " + id)
|
||||
print(time.time() - start)
|
||||
await movie.close_session()
|
||||
|
|
@ -5,7 +5,7 @@ pipeline:
|
|||
- pip install -r requirements.txt
|
||||
- pip install flake8
|
||||
- python3 test_tmdb.py
|
||||
- flake8 --ignore=E501 --exclude=__init__.py
|
||||
- flake8 --ignore=E501 --exclude=__init__.py --exclude=test_tmdb.py
|
||||
|
||||
build:
|
||||
image: alpine
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
maubot
|
||||
requests
|
||||
aiohttp
|
|
@ -13,9 +13,9 @@ GNU Affero General Public License for more details.
|
|||
You should have received a copy of the GNU Affero General Public License
|
||||
along with tmdb-bot. If not, see <https://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import requests
|
||||
from html import escape
|
||||
import aiohttp, asyncio
|
||||
import aiohttp
|
||||
import asyncio
|
||||
|
||||
|
||||
class TmdbApi():
|
||||
|
@ -65,8 +65,8 @@ class TmdbApiSingle(TmdbApi):
|
|||
|
||||
def get_image_binary(self):
|
||||
if self.poster_url:
|
||||
return requests.get(self.poster_url).content
|
||||
else:
|
||||
async with self.session.get(self.poster_url) as resp:
|
||||
return await resp.json()
|
||||
return None
|
||||
|
||||
def set_poster_size(self, size):
|
||||
|
@ -126,8 +126,7 @@ class Movie(TmdbApiSingle):
|
|||
movie_id = json['results'][0]['id']
|
||||
await asyncio.gather(
|
||||
self.query_details(movie_id),
|
||||
self.query_cast(movie_id)
|
||||
)
|
||||
self.query_cast(movie_id))
|
||||
return movie_id
|
||||
|
||||
async def query_details(self, id):
|
||||
|
|
Loading…
Reference in a new issue