Remove duplicate token manager initialization and move ImageKit import to top-level.
Browse files
social_media_publishers/instagram/publisher.py
CHANGED
|
@@ -51,7 +51,6 @@ class InstagramPublisher(SocialPublisher):
|
|
| 51 |
hf_repo_id="ai-workbench/data_process"
|
| 52 |
)
|
| 53 |
self.token_manager = TokenManager(config)
|
| 54 |
-
self.token_manager = TokenManager(config)
|
| 55 |
except Exception as e:
|
| 56 |
logger.warning(f"⚠️ Could not initialize TokenManager: {e}")
|
| 57 |
|
|
|
|
| 51 |
hf_repo_id="ai-workbench/data_process"
|
| 52 |
)
|
| 53 |
self.token_manager = TokenManager(config)
|
|
|
|
| 54 |
except Exception as e:
|
| 55 |
logger.warning(f"⚠️ Could not initialize TokenManager: {e}")
|
| 56 |
|
src/imagekit_utils.py
CHANGED
|
@@ -3,13 +3,13 @@ ImageKit.io utilities for temporary file hosting.
|
|
| 3 |
Used as a fallback when GCS is unavailable.
|
| 4 |
"""
|
| 5 |
from typing import Optional, Dict, Any
|
|
|
|
| 6 |
from src.config import get_config_value
|
| 7 |
from src.utils import logger
|
| 8 |
|
| 9 |
def get_imagekit_client() -> Optional[ImageKit]:
|
| 10 |
"""Initialize and return ImageKit client using config values."""
|
| 11 |
import os
|
| 12 |
-
from imagekitio import ImageKit # <-- import INSIDE function
|
| 13 |
|
| 14 |
# Debug (you will see they exist now)
|
| 15 |
print("IK public:", bool(os.environ.get("IMAGEKIT_PUBLIC_KEY")))
|
|
|
|
| 3 |
Used as a fallback when GCS is unavailable.
|
| 4 |
"""
|
| 5 |
from typing import Optional, Dict, Any
|
| 6 |
+
from imagekitio import ImageKit
|
| 7 |
from src.config import get_config_value
|
| 8 |
from src.utils import logger
|
| 9 |
|
| 10 |
def get_imagekit_client() -> Optional[ImageKit]:
|
| 11 |
"""Initialize and return ImageKit client using config values."""
|
| 12 |
import os
|
|
|
|
| 13 |
|
| 14 |
# Debug (you will see they exist now)
|
| 15 |
print("IK public:", bool(os.environ.get("IMAGEKIT_PUBLIC_KEY")))
|