How to use the trakt.users.User function in trakt

To help you get started, we’ve selected a few trakt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moogar0880 / PyTrakt / tests / test_episodes.py View on Github external
def test_episode_watching_now():
    e1 = TVEpisode('Game of Thrones', season=1, number=1)
    assert all([isinstance(u, User) for u in e1.watching_now])
github moogar0880 / PyTrakt / tests / test_users.py View on Github external
def test_requests():
    getters = [get_all_requests, User('sean').get_follower_requests]
    for getter in getters:
        requests = getter()
        assert isinstance(requests, list)
        assert all([isinstance(r, Request) for r in requests])
        for request in requests:
            r = request.approve()
            assert r is None
            r = request.deny()
            assert r is None
github moogar0880 / PyTrakt / tests / test_shows.py View on Github external
def test_watching():
    got = TVShow('Game of Thrones')
    assert all(isinstance(u, User) for u in got.watching_now)
github moogar0880 / PyTrakt / tests / test_users.py View on Github external
def test_user_watchlists():
    sean = User('sean')
    for _ in range(2):
        assert all([isinstance(m, Movie) for m in sean.watchlist_movies])
        assert all([isinstance(s, TVShow) for s in sean.watchlist_shows])
github moogar0880 / PyTrakt / tests / UserTests.py View on Github external
def setUp(self):
        """Grab environment information for validation"""
        self.user = User(os.environ['TRAKT_TEST_USER'])
github moogar0880 / PyTrakt / tests / test_users.py View on Github external
def test_stats():
    sean = User('sean')
    assert isinstance(sean.get_stats(), dict)
github moogar0880 / PyTrakt / tests / test_users.py View on Github external
def test_watching():
    sean = User('sean')
    sean.username = 'sean-movie'
    assert isinstance(sean.watching, Movie)
    sean.username = 'sean-episode'
    assert isinstance(sean.watching, TVEpisode)
    sean.username = 'sean-nothing'
    assert sean.watching is None
github moogar0880 / PyTrakt / trakt / users.py View on Github external
def get_all_requests():
    """Get a list of all follower requests including the timestamp when the
    request was made. Use the approve and deny methods to manage each request.
    """
    data = yield 'users/requests'
    request_list = []
    for request in data:
        request['user'] = User(**request.pop('user'))
        request_list.append(Request(**request))
    yield request_list
github moogar0880 / PyTrakt / trakt / tv.py View on Github external
def comments(self):
        """All comments (shouts and reviews) for this :class:`TVSeason`. Most
        recent comments returned first.
        """
        # TODO (jnappi) Pagination
        from .users import User

        data = yield (self.ext + '/comments')
        self._comments = []
        for com in data:
            user = User(**com.pop('user'))
            comment = Comment(user=user, **com)
            self._comments.append(comment)
        yield self._comments
github moogar0880 / PyTrakt / trakt / tv.py View on Github external
def watching_now(self):
        """A list of all :class:`User`'s watching a movie."""
        from .users import User

        data = yield self.ext + '/watching'
        users = []
        for user in data:
            users.append(User(**user))
        yield users