From e87bf33078e92304748f44ec6eec15e0c706dbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 11 Jul 2026 15:19:34 +0300 Subject: [PATCH 1/2] Add module level logger to user module --- trakt/users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trakt/users.py b/trakt/users.py index b7128bf..c981b35 100644 --- a/trakt/users.py +++ b/trakt/users.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """Interfaces to all of the User objects offered by the Trakt.tv API""" +import logging from dataclasses import dataclass, fields from typing import Any, NamedTuple, Optional, Union @@ -16,6 +17,7 @@ __all__ = ['User', 'UserList', 'PublicList', 'Request', 'follow', 'get_all_requests', 'get_user_settings', 'unfollow'] +logger = logging.getLogger(__name__) class Request(NamedTuple): id: int From 96780f136ac5b8c5334816ad91da5598b25a8b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 11 Jul 2026 15:17:45 +0300 Subject: [PATCH 2/2] Handle invalid data in build_movies --- trakt/users.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/trakt/users.py b/trakt/users.py index c981b35..efe71c9 100644 --- a/trakt/users.py +++ b/trakt/users.py @@ -524,11 +524,19 @@ def _build_movies(data): :param data: List of raw movie dicts from the Trakt API :return: List of :class:`Movie` instances """ + movies = [] for movie in data: movie_data = movie.pop('movie') + # Title is required for Movie model + if movie_data.get('title') is None: + original = dict(**movie, **{'movie': movie_data}) + logger.warning("Ignoring invalid Movie with no title: %s", original) + continue + movie_data.update(movie) movies.append(Movie(**movie_data)) + return movies @get