aws-python-helper 0.25.0__tar.gz → 0.26.0__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.
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/PKG-INFO +1 -1
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sns/publisher.py +52 -28
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/PKG-INFO +1 -1
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/pyproject.toml +1 -1
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/README.md +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/auth_middleware.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/auth_validators.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/base.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/dispatcher.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/exceptions.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/fetcher.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/handler.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/database_proxy.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/external_database_proxy.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/external_mongo_manager.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/mongo_manager.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/executor.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/fetcher.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/handler.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/task_base.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/base.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/fetcher.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/handler.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sns/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sqs/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sqs/consumer_base.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sqs/fetcher.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sqs/handler.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/utils/__init__.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/utils/json_encoder.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/utils/response.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/utils/serializer.py +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/SOURCES.txt +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/dependency_links.txt +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/requires.txt +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/top_level.txt +0 -0
- {aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/setup.cfg +0 -0
|
@@ -117,29 +117,13 @@ class SNSPublisher(ABC):
|
|
|
117
117
|
Message ID
|
|
118
118
|
"""
|
|
119
119
|
try:
|
|
120
|
-
# Serialize message
|
|
121
|
-
content = message.get("content")
|
|
122
|
-
if not content:
|
|
123
|
-
raise ValueError("Message content is required")
|
|
124
|
-
|
|
125
|
-
content = self._serialize_message(content)
|
|
126
|
-
attributes = message.get("attributes")
|
|
127
|
-
subject = message.get("subject")
|
|
128
120
|
|
|
129
121
|
# Prepare parameters
|
|
130
122
|
params = {
|
|
131
123
|
'TopicArn': self.topic_arn,
|
|
132
|
-
|
|
124
|
+
**self._format_message(message)
|
|
133
125
|
}
|
|
134
|
-
|
|
135
|
-
# Add subject if exists
|
|
136
|
-
if subject:
|
|
137
|
-
params['Subject'] = subject
|
|
138
|
-
|
|
139
|
-
# Add message attributes if exist
|
|
140
|
-
if attributes:
|
|
141
|
-
params['MessageAttributes'] = self._format_attributes(attributes)
|
|
142
|
-
|
|
126
|
+
|
|
143
127
|
# Publish
|
|
144
128
|
response = self.sns_client.publish(**params)
|
|
145
129
|
|
|
@@ -181,23 +165,31 @@ class SNSPublisher(ABC):
|
|
|
181
165
|
Returns:
|
|
182
166
|
List of message IDs
|
|
183
167
|
"""
|
|
184
|
-
|
|
168
|
+
message_to_publish = []
|
|
169
|
+
message_ids_success = []
|
|
170
|
+
message_ids_failed = []
|
|
171
|
+
|
|
172
|
+
params = {
|
|
173
|
+
'TopicArn': self.topic_arn
|
|
174
|
+
}
|
|
185
175
|
|
|
186
176
|
for i, message in enumerate(messages):
|
|
187
177
|
try:
|
|
188
|
-
|
|
189
|
-
message_ids.append(message_id)
|
|
178
|
+
message_to_publish.append(self._format_message(message))
|
|
190
179
|
except Exception as e:
|
|
191
180
|
self.logger.error(f"Error publishing message {i} in batch: {e}")
|
|
192
181
|
# Continue with the other messages
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
182
|
+
continue
|
|
183
|
+
|
|
184
|
+
result = self.sns_client.publish_batch(**params)
|
|
185
|
+
|
|
186
|
+
for message in result['Successful']:
|
|
187
|
+
message_ids_success.append(message['MessageId'])
|
|
188
|
+
|
|
189
|
+
for message in result['Failed']:
|
|
190
|
+
message_ids_failed.append(None)
|
|
199
191
|
|
|
200
|
-
return
|
|
192
|
+
return message_ids_success, message_ids_failed
|
|
201
193
|
|
|
202
194
|
def _serialize_message(self, content: Dict[str, Any]) -> str:
|
|
203
195
|
"""
|
|
@@ -243,3 +235,35 @@ class SNSPublisher(ABC):
|
|
|
243
235
|
}
|
|
244
236
|
|
|
245
237
|
return formatted
|
|
238
|
+
|
|
239
|
+
def _format_message(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
|
240
|
+
"""
|
|
241
|
+
Formats the message for SNS
|
|
242
|
+
|
|
243
|
+
Args:
|
|
244
|
+
message: Message to format
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
Formatted message
|
|
248
|
+
"""
|
|
249
|
+
content = message.get("content")
|
|
250
|
+
if not content:
|
|
251
|
+
raise ValueError("Message content is required")
|
|
252
|
+
|
|
253
|
+
content = self._serialize_message(content)
|
|
254
|
+
attributes = message.get("attributes")
|
|
255
|
+
subject = message.get("subject")
|
|
256
|
+
|
|
257
|
+
params = {
|
|
258
|
+
'Message': content
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
# Add subject if exists
|
|
262
|
+
if subject:
|
|
263
|
+
params['Subject'] = subject
|
|
264
|
+
|
|
265
|
+
# Add message attributes if exist
|
|
266
|
+
if attributes:
|
|
267
|
+
params['MessageAttributes'] = self._format_attributes(attributes)
|
|
268
|
+
|
|
269
|
+
return params
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/auth_middleware.py
RENAMED
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/api/auth_validators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/__init__.py
RENAMED
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/database_proxy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/database/mongo_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/fargate/task_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/base.py
RENAMED
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/fetcher.py
RENAMED
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/lambda_standalone/handler.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/sqs/consumer_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper/utils/json_encoder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/requires.txt
RENAMED
|
File without changes
|
{aws_python_helper-0.25.0 → aws_python_helper-0.26.0}/aws_python_helper.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|