diff --git a/plex_meta_manager.py b/plex_meta_manager.py index 80a76953..95e78b04 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -3,6 +3,15 @@ from concurrent.futures import ProcessPoolExecutor from datetime import datetime from modules.logs import MyLogger +from requests_cache import install_cache +from datetime import datetime, timedelta +install_cache( + 'config/http_cache', + expire_after=timedelta(days=1), # Otherwise expire responses after one day + allowable_methods=['GET', 'POST'], # Cache POST requests to avoid sending the same data twice + allowable_codes=[200], + match_headers=True, +) try: import plexapi, requests, schedule from PIL import ImageFile diff --git a/requirements.txt b/requirements.txt index 6f4dbe91..692b6666 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ tmdbapis==1.0.6 arrapi==1.3.1 lxml==4.9.1 requests==2.28.1 +requests-cache==0.9.6 ruamel.yaml==0.17.21 schedule==1.1.0 retrying==1.3.3