documente_shared 0.1.38__py3-none-any.whl → 0.1.39__py3-none-any.whl
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 documente_shared might be problematic. Click here for more details.
- documente_shared/application/digest.py +7 -7
- documente_shared/application/exceptions.py +23 -0
- documente_shared/application/time_utils.py +9 -9
- documente_shared/domain/base_enum.py +53 -53
- documente_shared/domain/entities/document_process.py +226 -226
- documente_shared/domain/entities/document_process_metadata.py +64 -64
- documente_shared/domain/enums.py +22 -22
- documente_shared/domain/repositories.py +24 -24
- documente_shared/infrastructure/dynamo_repositories.py +43 -43
- documente_shared/infrastructure/dynamo_table.py +75 -75
- documente_shared/infrastructure/s3_bucket.py +57 -57
- documente_shared/infrastructure/sqs_queue.py +47 -47
- {documente_shared-0.1.38.dist-info → documente_shared-0.1.39.dist-info}/METADATA +2 -1
- documente_shared-0.1.39.dist-info/RECORD +20 -0
- documente_shared-0.1.38.dist-info/RECORD +0 -19
- {documente_shared-0.1.38.dist-info → documente_shared-0.1.39.dist-info}/WHEEL +0 -0
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import boto3
|
|
3
|
-
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@dataclass
|
|
8
|
-
class SQSQueue(object):
|
|
9
|
-
queue_url: str
|
|
10
|
-
visibility_timeout: int = 60 * 10
|
|
11
|
-
waiting_timeout: int = 20
|
|
12
|
-
|
|
13
|
-
def __post_init__(self):
|
|
14
|
-
self._client = boto3.client('sqs')
|
|
15
|
-
|
|
16
|
-
def send_message(
|
|
17
|
-
self,
|
|
18
|
-
payload: dict,
|
|
19
|
-
message_attributes: dict = None,
|
|
20
|
-
delay_seconds: dict = None,
|
|
21
|
-
message_group_id: dict = None,
|
|
22
|
-
message_deduplication_id: dict =None,
|
|
23
|
-
):
|
|
24
|
-
message_params = {
|
|
25
|
-
'QueueUrl': self.queue_url,
|
|
26
|
-
'MessageBody': json.dumps(payload),
|
|
27
|
-
'MessageAttributes': message_attributes,
|
|
28
|
-
'DelaySeconds': delay_seconds,
|
|
29
|
-
'MessageGroupId': message_group_id,
|
|
30
|
-
'MessageDeduplicationId': message_deduplication_id,
|
|
31
|
-
}
|
|
32
|
-
clean_params = {key: value for key, value in message_params.items() if value}
|
|
33
|
-
return self._client.send_message(**clean_params)
|
|
34
|
-
|
|
35
|
-
def delete_message(self, receipt_handle: str):
|
|
36
|
-
return self._client.delete_message(
|
|
37
|
-
QueueUrl=self.queue_url,
|
|
38
|
-
ReceiptHandle=receipt_handle
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
def fetch_messages(self, num_messages: int = 1) -> list[dict]:
|
|
42
|
-
response = self._client.receive_message(
|
|
43
|
-
QueueUrl=self.queue_url,
|
|
44
|
-
MaxNumberOfMessages=num_messages,
|
|
45
|
-
VisibilityTimeout=self.visibility_timeout,
|
|
46
|
-
WaitTimeSeconds=self.waiting_timeout,
|
|
47
|
-
)
|
|
1
|
+
import json
|
|
2
|
+
import boto3
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class SQSQueue(object):
|
|
9
|
+
queue_url: str
|
|
10
|
+
visibility_timeout: int = 60 * 10
|
|
11
|
+
waiting_timeout: int = 20
|
|
12
|
+
|
|
13
|
+
def __post_init__(self):
|
|
14
|
+
self._client = boto3.client('sqs')
|
|
15
|
+
|
|
16
|
+
def send_message(
|
|
17
|
+
self,
|
|
18
|
+
payload: dict,
|
|
19
|
+
message_attributes: dict = None,
|
|
20
|
+
delay_seconds: dict = None,
|
|
21
|
+
message_group_id: dict = None,
|
|
22
|
+
message_deduplication_id: dict =None,
|
|
23
|
+
):
|
|
24
|
+
message_params = {
|
|
25
|
+
'QueueUrl': self.queue_url,
|
|
26
|
+
'MessageBody': json.dumps(payload),
|
|
27
|
+
'MessageAttributes': message_attributes,
|
|
28
|
+
'DelaySeconds': delay_seconds,
|
|
29
|
+
'MessageGroupId': message_group_id,
|
|
30
|
+
'MessageDeduplicationId': message_deduplication_id,
|
|
31
|
+
}
|
|
32
|
+
clean_params = {key: value for key, value in message_params.items() if value}
|
|
33
|
+
return self._client.send_message(**clean_params)
|
|
34
|
+
|
|
35
|
+
def delete_message(self, receipt_handle: str):
|
|
36
|
+
return self._client.delete_message(
|
|
37
|
+
QueueUrl=self.queue_url,
|
|
38
|
+
ReceiptHandle=receipt_handle
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def fetch_messages(self, num_messages: int = 1) -> list[dict]:
|
|
42
|
+
response = self._client.receive_message(
|
|
43
|
+
QueueUrl=self.queue_url,
|
|
44
|
+
MaxNumberOfMessages=num_messages,
|
|
45
|
+
VisibilityTimeout=self.visibility_timeout,
|
|
46
|
+
WaitTimeSeconds=self.waiting_timeout,
|
|
47
|
+
)
|
|
48
48
|
return response.get('Messages', [])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: documente_shared
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.39
|
|
4
4
|
Summary: Shared utilities for Documente AI projects
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Tech
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Requires-Dist: boto3 (>=1.34.102,<2.0.0)
|
|
15
15
|
Requires-Dist: botocore (>=1.34.102,<2.0.0)
|
|
16
|
+
Requires-Dist: sentry-sdk (>=1.0.0,<2.0.0)
|
|
16
17
|
Description-Content-Type: text/markdown
|
|
17
18
|
|
|
18
19
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
documente_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
documente_shared/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
documente_shared/application/digest.py,sha256=9T5e5SC1EKYrIjcmzqnlG29pyjJl29q0kdNl-zgsmws,179
|
|
4
|
+
documente_shared/application/exceptions.py,sha256=tr7vC3_MnetL_3xU9APDj7yqfKWDWdufELJ_m31yqjs,677
|
|
5
|
+
documente_shared/application/time_utils.py,sha256=Y8_ZVOp0_lNIAmiL4WcZIuPZPdTFxR0UBu5MN2w7amU,318
|
|
6
|
+
documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
documente_shared/domain/base_enum.py,sha256=KihiZGq1ylvQaWjEWtPHCAw9uFpFWsu8eJtLB_nwaWs,1502
|
|
8
|
+
documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
documente_shared/domain/entities/document_process.py,sha256=qGrmI3dMVoVf31P3ipofWhxqK6IXOfRQtbgar3Uw2bg,8454
|
|
10
|
+
documente_shared/domain/entities/document_process_metadata.py,sha256=A5TQr3R_F5Wx6hCJemNvQuAEZ9A6BKLMosk1ATIcMso,2415
|
|
11
|
+
documente_shared/domain/enums.py,sha256=HvldnfdCV5HiCnG8AN6L2ROrbwyWmqeDVBbl5piaB1M,485
|
|
12
|
+
documente_shared/domain/repositories.py,sha256=zjI6EMTwWeABIwKt_egV65fKRHP-sCoxiZNvV2KfVC0,762
|
|
13
|
+
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
documente_shared/infrastructure/dynamo_repositories.py,sha256=eKXbUNVa61HqXr5dnZCsk2CB6GnvOGDdJtTMRnuu41s,1437
|
|
15
|
+
documente_shared/infrastructure/dynamo_table.py,sha256=JZsa1qzPPV19sgcxl257z0B9kMfswjITg30YywLKQ5E,2187
|
|
16
|
+
documente_shared/infrastructure/s3_bucket.py,sha256=YPCFAXSw6o57y5S9PMLr4fCE3KD740yVCDo4dDjd-vU,1997
|
|
17
|
+
documente_shared/infrastructure/sqs_queue.py,sha256=Yo7AhDc4TwIFNjOJnBueCxql2Vqb9_BDMvu4wskAARU,1552
|
|
18
|
+
documente_shared-0.1.39.dist-info/METADATA,sha256=NzQuc9uZ7nJJuwYM0746eLqNUphutenoj-OKNxcAbO8,683
|
|
19
|
+
documente_shared-0.1.39.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
20
|
+
documente_shared-0.1.39.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
documente_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
documente_shared/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
documente_shared/application/digest.py,sha256=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-opEOzDCWc,172
|
|
4
|
-
documente_shared/application/time_utils.py,sha256=XDH27cKgoTFO8ad1JgrxKaeT7sZ1fduuJqLkvHUjy-Q,309
|
|
5
|
-
documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
|
|
7
|
-
documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
documente_shared/domain/entities/document_process.py,sha256=8uwFnxfb-5uS0kojtRlqz8QpJ_-TklK0_uImGWilwpU,8228
|
|
9
|
-
documente_shared/domain/entities/document_process_metadata.py,sha256=rBHkDkoKwrxReKtXIScU1vrCO_6bg2LwWhrtXMcQ8TA,2351
|
|
10
|
-
documente_shared/domain/enums.py,sha256=s3bFDkpplWvJWNpUwPOkC9a3OYUYsx8uTusN_FrzNQk,463
|
|
11
|
-
documente_shared/domain/repositories.py,sha256=o9_ty3NPxCjb4hHIZbk71ECLqTjoKQI5MKWQje1KEyk,738
|
|
12
|
-
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
documente_shared/infrastructure/dynamo_repositories.py,sha256=w_AW3IACVxRU7A3mNma2Elpbx7naRV4wY5mChW1WmZQ,1394
|
|
14
|
-
documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
|
|
15
|
-
documente_shared/infrastructure/s3_bucket.py,sha256=Nf4bHSC3TJeaKvOQSVtV1hG8dWqEZZnA-JWU0PNTw24,1940
|
|
16
|
-
documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
|
|
17
|
-
documente_shared-0.1.38.dist-info/METADATA,sha256=oYUcJKoQvWxWiqVrSL5TUVN1SOt9fyzRncRNesDCtSo,640
|
|
18
|
-
documente_shared-0.1.38.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
19
|
-
documente_shared-0.1.38.dist-info/RECORD,,
|
|
File without changes
|