documente_shared 0.1.52__py3-none-any.whl → 0.1.53b0__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.52
3
+ Version: 0.1.53b0
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -0,0 +1,22 @@
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/application/timezone.py,sha256=NHpzTzOPD_fWQiJ4BrRqt_TIDs5XyB5ZMR7x8vUk8gQ,183
7
+ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
9
+ documente_shared/domain/constants.py,sha256=jOlMKFq12FgiYMJcQHku8IVwuOE5t-HEPuSV_zEeIFo,56
10
+ documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ documente_shared/domain/entities/document.py,sha256=X8uEw7TCy5o87-kscok2CcH67exsE6BrRqs6L-SvuTg,10111
12
+ documente_shared/domain/entities/document_metadata.py,sha256=Oa-c0xJODXaGtFkNxt9k86rSWGxY2LHVDOgu9tQxCGY,2354
13
+ documente_shared/domain/enums.py,sha256=EA8RsuusX065Isp8qUTv9TPpWPkae6mbIC-yYENrkow,926
14
+ documente_shared/domain/repositories.py,sha256=g3qLUy2kT8esmvU4VxxSVnDaXeySKKQ7mUvIvxOwh9A,757
15
+ documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ documente_shared/infrastructure/dynamo_repositories.py,sha256=SEad_HLppp2h_BKDSzb9oo1VlAVRZWelOPvJPlDwbzQ,1453
17
+ documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
18
+ documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
19
+ documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
20
+ documente_shared-0.1.53b0.dist-info/METADATA,sha256=lsEFzk1QfNagA9YSm3Jlkw7Dm53a-6IFP7_nAtJ_NsM,684
21
+ documente_shared-0.1.53b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
+ documente_shared-0.1.53b0.dist-info/RECORD,,
@@ -1,22 +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=zrV-wPYXLFUQhA_0hoXKnFAhNntNG17oGB_MU_YhtIg,677
5
- documente_shared/application/time_utils.py,sha256=Y8_ZVOp0_lNIAmiL4WcZIuPZPdTFxR0UBu5MN2w7amU,318
6
- documente_shared/application/timezone.py,sha256=RlLmdvGlMJ-TSfGrTRm1wlJPwpc-_bu9RtWwdKYIPfo,190
7
- documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- documente_shared/domain/base_enum.py,sha256=KihiZGq1ylvQaWjEWtPHCAw9uFpFWsu8eJtLB_nwaWs,1502
9
- documente_shared/domain/constants.py,sha256=lws6A8b4KM2ch9DAh4Xvpvi_1oWNf_cc0kL3NwpMUOc,58
10
- documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- documente_shared/domain/entities/document.py,sha256=wr04dWzp_1NoF6-_Vv4sTTsJpUPE3mYuw5HnRWigUas,9946
12
- documente_shared/domain/entities/document_metadata.py,sha256=8o8vZki-PK2PvjVKy8PLfYWTTWKVm5qqOX_Jt251yvY,2418
13
- documente_shared/domain/enums.py,sha256=J6VqOhlfr4Fd-OYubUiqIDCnPk4LeRmmsdk1xkrz3sM,962
14
- documente_shared/domain/repositories.py,sha256=GZLzlDi1HUKx48nU37bczkGsuxSQGBfyv90n6iBk0wA,781
15
- documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- documente_shared/infrastructure/dynamo_repositories.py,sha256=G79N6KGdPXRMNYKvIRvQ0_s5Z_ogFgoNV9N4poKvfHo,1496
17
- documente_shared/infrastructure/dynamo_table.py,sha256=JZsa1qzPPV19sgcxl257z0B9kMfswjITg30YywLKQ5E,2187
18
- documente_shared/infrastructure/s3_bucket.py,sha256=qPCBpheM1qvtC08vynlwIGJZCCOhefFcD3Q3ClusXmM,1989
19
- documente_shared/infrastructure/sqs_queue.py,sha256=Yo7AhDc4TwIFNjOJnBueCxql2Vqb9_BDMvu4wskAARU,1552
20
- documente_shared-0.1.52.dist-info/METADATA,sha256=be_-1RRh0y-G525JDGJKYCLuM_QYoDiiVuHwZ5J0emo,682
21
- documente_shared-0.1.52.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
- documente_shared-0.1.52.dist-info/RECORD,,