documente_shared 0.1.39__py3-none-any.whl → 0.1.41__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.

@@ -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.39
3
+ Version: 0.1.41
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -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=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-opEOzDCWc,172
4
+ documente_shared/application/exceptions.py,sha256=lQM8m7wmI9OTLGva0gd7s7YT7ldaTk_Ln4t32PpzNf8,654
5
+ documente_shared/application/time_utils.py,sha256=XDH27cKgoTFO8ad1JgrxKaeT7sZ1fduuJqLkvHUjy-Q,309
6
+ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
8
+ documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ documente_shared/domain/entities/document_process.py,sha256=8uwFnxfb-5uS0kojtRlqz8QpJ_-TklK0_uImGWilwpU,8228
10
+ documente_shared/domain/entities/document_process_metadata.py,sha256=rBHkDkoKwrxReKtXIScU1vrCO_6bg2LwWhrtXMcQ8TA,2351
11
+ documente_shared/domain/enums.py,sha256=09XsW1shwvr67gQVMMomEomN3JjMUL9IvbZdGg2nnMM,557
12
+ documente_shared/domain/repositories.py,sha256=o9_ty3NPxCjb4hHIZbk71ECLqTjoKQI5MKWQje1KEyk,738
13
+ documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ documente_shared/infrastructure/dynamo_repositories.py,sha256=w_AW3IACVxRU7A3mNma2Elpbx7naRV4wY5mChW1WmZQ,1394
15
+ documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
16
+ documente_shared/infrastructure/s3_bucket.py,sha256=Nf4bHSC3TJeaKvOQSVtV1hG8dWqEZZnA-JWU0PNTw24,1940
17
+ documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
18
+ documente_shared-0.1.41.dist-info/METADATA,sha256=n5FuXuiUhbt7YRzlgLD_utc3gGe-wjjFnISmQ2DyANQ,683
19
+ documente_shared-0.1.41.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
20
+ documente_shared-0.1.41.dist-info/RECORD,,
@@ -1,20 +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=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,,