|
1 | 1 | """Email client for simplified email sending via SAP Ariba Output Service.""" |
2 | 2 |
|
3 | | -from typing import Optional, List, Dict, Any |
| 3 | +import logging |
| 4 | +from typing import Optional, List, Dict, Any, TYPE_CHECKING |
| 5 | + |
4 | 6 | from ..models.output_request import OutputRequest |
5 | 7 | from ..models.output_request_data import OutputRequestData |
6 | 8 | from ..models.output_management_info import OutputManagementInfo |
7 | 9 | from ..models.email_configuration import EmailConfiguration |
8 | 10 | from ..models.output_response import OutputResponse, ErrorResponse |
| 11 | +from ..models.attachment_config import AttachmentConfig |
| 12 | +from ..models.pre_generated_attachment import PreGeneratedAttachment |
9 | 13 | from ..config.destination_credential_config import DestinationCredentialConfig |
10 | 14 | from ..constants import Channel |
11 | 15 | from ..utils.request_validator import RequestValidator |
12 | 16 |
|
| 17 | +if TYPE_CHECKING: |
| 18 | + from ..client_provider import OutputManagementServiceClientProviderBuilder |
| 19 | + |
| 20 | +logger = logging.getLogger(__name__) |
| 21 | + |
13 | 22 |
|
14 | 23 | class EmailClient: |
15 | 24 | """ |
@@ -67,9 +76,6 @@ def create_output_request( |
67 | 76 | # Build attachment config if URLs are provided |
68 | 77 | attachment_config = None |
69 | 78 | if attachment_urls: |
70 | | - from ..models.attachment_config import AttachmentConfig |
71 | | - from ..models.pre_generated_attachment import PreGeneratedAttachment |
72 | | - |
73 | 79 | # Convert URLs to PreGeneratedAttachment objects |
74 | 80 | pre_gen_attachments = [ |
75 | 81 | PreGeneratedAttachment(url=url, source="DMS") |
@@ -217,10 +223,8 @@ def send_email( |
217 | 223 | ) |
218 | 224 |
|
219 | 225 | try: |
220 | | - # Import here to avoid circular import at module initialization |
| 226 | + # Import here to avoid circular import (client.py -> email_client.py -> client_provider.py -> client.py) |
221 | 227 | from ..client_provider import OutputManagementServiceClientProviderBuilder |
222 | | - import logging |
223 | | - logger = logging.getLogger(__name__) |
224 | 228 |
|
225 | 229 | # Resolve instance name for logging |
226 | 230 | inst = instance or "default" |
|
0 commit comments