Skip to content

Commit

Permalink
Merge pull request #2130 from glensc/MyPlexAccount-cache
Browse files Browse the repository at this point in the history
Feature: Cache MyPlexAccount responses
  • Loading branch information
glensc authored Jan 28, 2025
2 parents e674236 + c4ec304 commit 93b2de6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plextraktsync/commands/plex_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def myplex_login(username: str, password: str, token=None, code=None):
password = Prompt.ask(PROMPT_PLEX_PASSWORD, password=True, default=password, show_default=False)
code = Prompt.ask(PROMPT_PLEX_CODE)
try:
return MyPlexAccount(username=username, password=password, code=code, token=token)
return MyPlexAccount(username=username, password=password, code=code, token=token, session=factory.session)
except Unauthorized as e:
if token:
raise e
Expand Down
2 changes: 2 additions & 0 deletions plextraktsync/config/HttpCacheConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class HttpCacheConfig:
# Cache for some time, this activates 304 responses
"plex.tv/users/account": "1m",
"plex.tv/api/v2/user": "15m",
# plex-login command
"plex.tv/api/v2/resources?includeHttps=1&includeRelay=1": "1m",
# Plex patterns
# Ratings search
"*/library/sections/*/all?*userRating*=-1*": "10s",
Expand Down

0 comments on commit 93b2de6

Please sign in to comment.