Trakt Core

Objects, properties, and methods to be shared across other modules in the trakt package

trakt.core.APPLICATION_ID = None

The ID of the application to register with, when using PIN authentication

trakt.core.AUTH_METHOD = 'PIN'

The currently enabled authentication method. Default is PIN_AUTH

class trakt.core.Airs(day, time, timezone)
day: str

Alias for field number 0

time: str

Alias for field number 1

timezone: str

Alias for field number 2

class trakt.core.Alias(title, country)
country: str

Alias for field number 1

title: str

Alias for field number 0

trakt.core.BASE_URL = 'https://api.trakt.tv/'

The base url for the Trakt API. Can be modified to run against different Trakt.tv environments

trakt.core.CLIENT_ID = None

The Trakt.tv OAuth Client ID for your OAuth Application

trakt.core.CLIENT_SECRET = None

The Trakt.tv OAuth Client Secret for your OAuth Application

trakt.core.CONFIG_PATH = '/home/runner/.pytrakt.json'

Default path for where to store your trakt.tv API authentication information

class trakt.core.Comment(id, parent_id, created_at, comment, spoiler, review, replies, user, updated_at, likes, user_rating)
comment: str

Alias for field number 3

created_at: str

Alias for field number 2

id: str

Alias for field number 0

likes: str

Alias for field number 9

parent_id: str

Alias for field number 1

replies: str

Alias for field number 6

review: str

Alias for field number 5

spoiler: str

Alias for field number 4

updated_at: str

Alias for field number 8

user: str

Alias for field number 7

user_rating: str

Alias for field number 10

trakt.core.DEVICE_AUTH = 'DEVICE'

Flag used to enable Trakt OAuth device authentication

class trakt.core.Genre(name, slug)
name: str

Alias for field number 0

slug: str

Alias for field number 1

trakt.core.OAUTH_AUTH = 'OAUTH'

Flag used to enable Trakt OAuth authentication

trakt.core.OAUTH_TOKEN = None

Your personal Trakt.tv OAUTH Bearer Token

trakt.core.PIN_AUTH = 'PIN'

Flag used to enable Trakt PIN authentication

trakt.core.TIMEOUT = 30

Timeout in seconds for all requests

trakt.core.api()

Create an HTTP client for interacting with the Trakt API using configured authentication.

Returns:

HttpClient: A configured HTTP client with token-based authentication for making API requests.

Notes:
  • Uses the global BASE_URL and session for creating the HTTP client

  • Configures the client with a TokenAuth instance using the current authentication configuration

  • Cached function that returns a same client instance on each call

trakt.core.config()
trakt.core.delete(f)
trakt.core.get(f)
trakt.core.init(*args, **kwargs)

Run the auth function specified by AUTH_METHOD

trakt.core.post(f)
trakt.core.put(f)