Create and return an S3 client with configuration from environment.
()
| 131 | |
| 132 | |
| 133 | def create_s3_client() -> BaseClient: |
| 134 | """Create and return an S3 client with configuration from environment.""" |
| 135 | config = get_s3_config() |
| 136 | # Log S3 client creation (excluding sensitive info) |
| 137 | log_config = config.copy() |
| 138 | has_credentials = bool(log_config.pop("aws_access_key_id", None) or log_config.pop("aws_secret_access_key", None)) |
| 139 | logger.debug( |
| 140 | "Creating S3 client", |
| 141 | extra={ |
| 142 | "s3_config": log_config, |
| 143 | "has_credentials": has_credentials, |
| 144 | }, |
| 145 | ) |
| 146 | return boto3.client("s3", **config) |
| 147 | |
| 148 | |
| 149 | def upload_to_s3(content: str, s3_file_path: str, ingest_id: UUID) -> str: |
no test coverage detected