Users

class trakt.users.User(username)

A Trakt.tv User

follow()

Follow this User

followers

A list of all followers including the since timestamp which is when the relationship began. Protected users won’t return any data unless you are friends. Any friends of the main user that are protected won’t display data either.

following

A list of all user’s this User follows including the since timestamp which is when the relationship began. Protected users won’t return any data unless you are friends. Any friends of the main user that are protected won’t display data either.

friends

A list of this User’s friends (a 2 way relationship where each user follows the other) including the since timestamp which is when the friendship began. Protected users won’t return any data unless you are friends. Any friends of the main user that are protected won’t display data either.

static get_follower_requests()

Return a list of all pending follower requests for the authenticated user

get_list(title)

Get the specified list from this User. Protected User’s won’t return any data unless you are friends. To view your own private lists, you will need to authenticate as yourself.

get_ratings(**kwargs)

Get a user’s ratings filtered by type. You can optionally filter for a specific rating between 1 and 10.

Parameters:
  • media_type – The type of media to search for. Must be one of ‘movies’, ‘shows’, ‘seasons’, ‘episodes’
  • rating – Optional rating between 1 and 10
get_stats(**kwargs)

Returns stats about the movies, shows, and episodes a user has watched and collected

lists

All custom lists for this User. Protected User’s won’t return any data unless you are friends. To view your own private lists, you will need to authenticate as yourself.

movie_collection

All Movie’s in this User’s library collection. Collection items might include blu-rays, dvds, and digital downloads. Protected users won’t return any data unless you are friends.

show_collection

All TVShow’s in this User’s library collection. Collection items might include blu-rays, dvds, and digital downloads. Protected users won’t return any data unless you are friends.

unfollow()

Unfollow this User, if you already follow them

watched_movies

Watched profess for all Movie’s in this User’s collection.

watched_shows

Watched profess for all TVShow’s in this User’s collection.

watching

The TVEpisode or Movie this User is currently watching. If they aren’t watching anything, a blank object will be returned. Protected users won’t return any data unless you are friends.

watchlist_movies

Returns all watchlist movies of User.

watchlist_shows

Returns all watchlist shows of User.

class trakt.users.UserList(user_name, slug='')

A list created by a Trakt.tv User

add_items(**kwargs)

Add items to this UserList, where items is an iterable

classmethod create(**kwargs)

Create a new custom class:UserList. name is the only required field, but the other info is recommended.

Parameters:
  • name – Name of the list.
  • description – Description of this list.
  • privacy – Valid values are ‘private’, ‘friends’, or ‘public’
  • display_numbers – Bool, should each item be numbered?
  • allow_comments – Bool, are comments allowed?
delete_list(**kwargs)

Delete this UserList

classmethod get(**kwargs)

Returns a single custom UserList

Parameters:title – Name of the list.
get_items(**kwargs)

A list of the list items using class instances instance types: movie, show, season, episode, person

like(**kwargs)

Like this UserList. Likes help determine popular lists. Only one like is allowed per list per user.

remove_items(**kwargs)

Remove items to this UserList, where items is an iterable

unlike(**kwargs)

Remove a like on this UserList.

Examples

To access a User all you need do is pass the User’s username to the User’s __init__ method

>>> from trakt.users import User
>>> my = User('moogar0880')
>>> my
'<User>: moogar0880'

Good, now we have a hold of the User object. Now we can get all of the information available from this trakt.tv User.

>>> my.gender
'male'
>>> my.location
'Newmarket NH'
>>> my.movie_collection
[<Movie>: b'2 Fast 2 Furious', <Movie>: b'A Beautiful Mind', <Movie>: b'A Bronx Tale', <Movie>: b"A Bug's Life", <Movie>: b'A Christmas Carol',...