Refactor downloader and file manager for improved rclone integration and add healthcheck and smoke test options
- Renamed download flags in ContentDownloader for clarity. - Enhanced FileManager with methods to build upload paths and verify existing files for rclone uploads. - Updated StreamProcessor to return success status for stream processing. - Added rclone smoke test and healthcheck functions to validate configuration and tool availability. - Improved environment variable handling with a utility function. - Updated TwitchArchive to incorporate new rclone verification and processing logic. - Added unit tests for new functionality and refactored existing tests for clarity and coverage. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
e92f36474a
commit
f97e0200d6
23 changed files with 1013 additions and 289 deletions
|
|
@ -9,6 +9,7 @@ import requests
|
|||
from colorama import Fore, Style
|
||||
|
||||
from .constants import TWITCH_OAUTH_URL, TWITCH_API_URL, TWITCH_GQL_URL, TWITCH_GQL_CLIENT_ID
|
||||
from .utils import get_env_value
|
||||
|
||||
|
||||
class StreamMonitor:
|
||||
|
|
@ -40,7 +41,9 @@ class StreamMonitor:
|
|||
return self._oauth_token
|
||||
|
||||
try:
|
||||
url = f"{TWITCH_OAUTH_URL}?client_id={os.getenv('CLIENT-ID')}&client_secret={os.getenv('CLIENT-SECRET')}&grant_type=client_credentials"
|
||||
client_id = get_env_value('CLIENT-ID', 'CLIENT_ID')
|
||||
client_secret = get_env_value('CLIENT-SECRET', 'CLIENT_SECRET')
|
||||
url = f"{TWITCH_OAUTH_URL}?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials"
|
||||
response = requests.post(url, timeout=15)
|
||||
response.raise_for_status()
|
||||
self._oauth_token = response.json()['access_token']
|
||||
|
|
@ -69,7 +72,7 @@ class StreamMonitor:
|
|||
url = f'{TWITCH_API_URL}/users?login={self.username}'
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.get_oauth_token()}",
|
||||
"Client-ID": os.getenv('CLIENT-ID')
|
||||
"Client-ID": get_env_value('CLIENT-ID', 'CLIENT_ID')
|
||||
}
|
||||
response = requests.get(url, headers=headers, timeout=15)
|
||||
response.raise_for_status()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue