srx-lib-azure 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of srx-lib-azure might be problematic. Click here for more details.
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/PKG-INFO +1 -1
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/pyproject.toml +1 -1
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/src/srx_lib_azure/blob.py +25 -11
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/src/srx_lib_azure/email.py +13 -6
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/src/srx_lib_azure/table.py +5 -2
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/.github/workflows/publish.yml +0 -0
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/.gitignore +0 -0
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/README.md +0 -0
- {srx_lib_azure-0.1.5 → srx_lib_azure-0.1.6}/src/srx_lib_azure/__init__.py +0 -0
|
@@ -10,18 +10,32 @@ from loguru import logger
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class AzureBlobService:
|
|
13
|
-
"""Minimal Azure Blob helper with SAS URL generation.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
"""Minimal Azure Blob helper with SAS URL generation.
|
|
14
|
+
|
|
15
|
+
All configuration can be passed explicitly via constructor. If omitted, falls back
|
|
16
|
+
to environment variables. By default, it does not warn at startup when not
|
|
17
|
+
configured; operations will error if required values are missing.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
*,
|
|
23
|
+
connection_string: Optional[str] = None,
|
|
24
|
+
account_key: Optional[str] = None,
|
|
25
|
+
container_name: Optional[str] = None,
|
|
26
|
+
base_blob_url: Optional[str] = None,
|
|
27
|
+
sas_token: Optional[str] = None,
|
|
28
|
+
warn_if_unconfigured: bool = False,
|
|
29
|
+
) -> None:
|
|
30
|
+
self.container_name = container_name or os.getenv("AZURE_BLOB_CONTAINER", "uploads")
|
|
31
|
+
self.connection_string = connection_string or os.getenv("AZURE_STORAGE_CONNECTION_STRING")
|
|
32
|
+
self.account_key = account_key or os.getenv("AZURE_STORAGE_ACCOUNT_KEY")
|
|
33
|
+
self.sas_token = sas_token or os.getenv("AZURE_SAS_TOKEN")
|
|
34
|
+
self.base_blob_url = base_blob_url or os.getenv("AZURE_BLOB_URL")
|
|
35
|
+
|
|
36
|
+
if warn_if_unconfigured and not self.connection_string:
|
|
23
37
|
logger.warning(
|
|
24
|
-
"Azure Storage connection string not configured; blob operations
|
|
38
|
+
"Azure Storage connection string not configured; blob operations may fail."
|
|
25
39
|
)
|
|
26
40
|
|
|
27
41
|
def _get_blob_service(self) -> BlobServiceClient:
|
|
@@ -17,14 +17,21 @@ class EmailService:
|
|
|
17
17
|
If not configured, send calls are skipped with a warning and a 'skipped' status.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
-
def __init__(
|
|
21
|
-
self
|
|
22
|
-
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
*,
|
|
23
|
+
connection_string: str | None = None,
|
|
24
|
+
sender_address: str | None = None,
|
|
25
|
+
warn_if_unconfigured: bool = False,
|
|
26
|
+
):
|
|
27
|
+
self.connection_string = connection_string or os.getenv("ACS_CONNECTION_STRING")
|
|
28
|
+
self.sender_address = sender_address or os.getenv("EMAIL_SENDER")
|
|
23
29
|
if not self.connection_string or not self.sender_address or EmailClient is None:
|
|
24
30
|
self.email_client = None
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
if warn_if_unconfigured:
|
|
32
|
+
logger.warning(
|
|
33
|
+
"EmailService not configured (missing ACS_CONNECTION_STRING/EMAIL_SENDER or azure SDK). Calls will be skipped."
|
|
34
|
+
)
|
|
28
35
|
else:
|
|
29
36
|
try:
|
|
30
37
|
self.email_client = EmailClient.from_connection_string(self.connection_string)
|
|
@@ -19,7 +19,11 @@ def _now_iso() -> str:
|
|
|
19
19
|
|
|
20
20
|
@dataclass
|
|
21
21
|
class AzureTableService:
|
|
22
|
-
connection_string: Optional[str] =
|
|
22
|
+
connection_string: Optional[str] = None
|
|
23
|
+
|
|
24
|
+
def __init__(self, connection_string: Optional[str] = None) -> None:
|
|
25
|
+
# Constructor injection preferred; fallback to env only if not provided
|
|
26
|
+
self.connection_string = connection_string or os.getenv("AZURE_STORAGE_CONNECTION_STRING")
|
|
23
27
|
|
|
24
28
|
def _get_client(self) -> "TableServiceClient":
|
|
25
29
|
if not self.connection_string:
|
|
@@ -76,4 +80,3 @@ class AzureTableService:
|
|
|
76
80
|
table = client.get_table_client(table_name)
|
|
77
81
|
for entity in table.query_entities(filter=filter_query):
|
|
78
82
|
yield dict(entity)
|
|
79
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|