Skip to content

Commit

Permalink
fix: enable conditional caching for Trakt API session
Browse files Browse the repository at this point in the history
  • Loading branch information
davidemarcoli committed Jan 21, 2025
1 parent 6975f9d commit c8d6c3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/program/apis/trakt_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
import os
import re
from datetime import datetime
from types import SimpleNamespace
from typing import List, Optional, Union
Expand Down Expand Up @@ -50,7 +51,8 @@ def __init__(self, settings: TraktModel):
self.oauth_redirect_uri = self.settings.oauth.oauth_redirect_uri
rate_limit_params = get_rate_limit_params(max_calls=1000, period=300)
trakt_cache = get_cache_params("trakt", 86400)
session = create_service_session(rate_limit_params=rate_limit_params, use_cache=True, cache_params=trakt_cache)
use_cache = not os.environ.get("SKIP_TRAKT_CACHE", False)
session = create_service_session(rate_limit_params=rate_limit_params, use_cache=use_cache, cache_params=trakt_cache)
self.headers = {
"Content-type": "application/json",
"trakt-api-key": self.CLIENT_ID,
Expand Down

0 comments on commit c8d6c3a

Please sign in to comment.