Skip to content

Commit 153d7bb

Browse files
committed
Add config factory to core
1 parent 84b8673 commit 153d7bb

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

trakt/core.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import time
1010
from datetime import datetime, timedelta, timezone
11-
from functools import wraps
11+
from functools import lru_cache, wraps
1212
from json import JSONDecodeError
1313
from typing import NamedTuple
1414
from urllib.parse import urljoin
@@ -366,6 +366,20 @@ def init(*args, **kwargs):
366366
return auth_method.get(AUTH_METHOD, PIN_AUTH)(*args, **kwargs)
367367

368368

369+
@lru_cache(maxsize=None)
370+
def config():
371+
from trakt.config import AuthConfig
372+
373+
return AuthConfig(CONFIG_PATH).update(
374+
APPLICATION_ID=APPLICATION_ID,
375+
CLIENT_ID=CLIENT_ID,
376+
CLIENT_SECRET=CLIENT_SECRET,
377+
OAUTH_EXPIRES_AT=OAUTH_EXPIRES_AT,
378+
OAUTH_REFRESH=OAUTH_REFRESH,
379+
OAUTH_TOKEN=OAUTH_TOKEN,
380+
)
381+
382+
369383
class Airs(NamedTuple):
370384
day: str
371385
time: str

0 commit comments

Comments
 (0)