libretificacaotjcore 0.1.26__tar.gz → 0.1.28__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.

Potentially problematic release.


This version of libretificacaotjcore might be problematic. Click here for more details.

Files changed (27) hide show
  1. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/PKG-INFO +2 -1
  2. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/services/rabbitmq_consumer.py +6 -5
  3. libretificacaotjcore-0.1.28/libretificacaotjcore/services/rabbitmq_publisher.py +56 -0
  4. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore.egg-info/PKG-INFO +2 -1
  5. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore.egg-info/requires.txt +1 -0
  6. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/pyproject.toml +49 -48
  7. libretificacaotjcore-0.1.26/libretificacaotjcore/services/rabbitmq_publisher.py +0 -52
  8. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/README.md +0 -0
  9. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/__init__.py +0 -0
  10. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/database/__init__.py +0 -0
  11. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/database/arquivo_repository.py +0 -0
  12. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/database/certificado_repository.py +0 -0
  13. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/database/config_db.py +0 -0
  14. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/database/protocolo_repository.py +0 -0
  15. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/dtos/__init__.py +0 -0
  16. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/dtos/arquivo_dto.py +0 -0
  17. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/dtos/solicitacao_dto.py +0 -0
  18. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/enums/__init__.py +0 -0
  19. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/enums/e_eventos.py +0 -0
  20. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/services/__init__.py +0 -0
  21. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/services/crypto_pass_service.py +0 -0
  22. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/services/file_service.py +0 -0
  23. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore/services/s3_service.py +0 -0
  24. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore.egg-info/SOURCES.txt +0 -0
  25. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore.egg-info/dependency_links.txt +0 -0
  26. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/libretificacaotjcore.egg-info/top_level.txt +0 -0
  27. {libretificacaotjcore-0.1.26 → libretificacaotjcore-0.1.28}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.26
3
+ Version: 0.1.28
4
4
  Summary: Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ
5
5
  Author-email: Jhonatan Azevedo <dev.azevedo@outlook.com>
6
6
  Project-URL: Homepage, https://github.com/seu-usuario/libretificacaotjcore
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Operating System :: OS Independent
22
22
  Requires-Python: >=3.12
23
23
  Description-Content-Type: text/markdown
24
+ Requires-Dist: aio-pika>=9.5.7
24
25
  Requires-Dist: aiofiles>=24.1.0
25
26
  Requires-Dist: boto3>=1.39.16
26
27
  Requires-Dist: cryptography>=45.0.6
@@ -5,11 +5,11 @@ import json
5
5
  class RabbitMQConsumer:
6
6
  def __init__(
7
7
  self,
8
- host,
9
- queue,
10
- username,
11
- password,
12
- vhost="/",
8
+ host: str,
9
+ queue: str,
10
+ username: str,
11
+ password: str,
12
+ vhost: str ="/",
13
13
  ):
14
14
  self.host = host
15
15
  self.queue = queue
@@ -18,6 +18,7 @@ class RabbitMQConsumer:
18
18
  self.vhost = vhost
19
19
  self.connection = None
20
20
  self.channel = None
21
+ self.connect()
21
22
 
22
23
  def connect(self):
23
24
  credentials = pika.PlainCredentials(self.username, self.password)
@@ -0,0 +1,56 @@
1
+ import aio_pika
2
+ import json
3
+ from aio_pika.abc import AbstractRobustConnection, AbstractChannel, AbstractQueue
4
+
5
+ class RabbitMQPublisher:
6
+ def __init__(
7
+ self,
8
+ host: str,
9
+ queue: str,
10
+ username: str,
11
+ password: str,
12
+ vhost: str = "/",
13
+ ):
14
+ self.host = host
15
+ self.queue = queue
16
+ self.username = username
17
+ self.password = password
18
+ self.vhost = vhost
19
+
20
+ self.connection: AbstractRobustConnection | None = None
21
+ self.channel: AbstractChannel | None = None
22
+ self.queue_obj: AbstractQueue | None = None
23
+
24
+ async def connect(self):
25
+ self.connection = await aio_pika.connect_robust(
26
+ host=self.host,
27
+ login=self.username,
28
+ password=self.password,
29
+ virtualhost=self.vhost,
30
+ heartbeat=60,
31
+ )
32
+
33
+
34
+ self.channel = await self.connection.channel()
35
+ # garante que mensagens não são perdidas
36
+ self.queue_obj = await self.channel.declare_queue(
37
+ self.queue, durable=True
38
+ )
39
+
40
+ async def publish(self, message: dict):
41
+ if not self.channel:
42
+ raise RuntimeError("❌ Canal RabbitMQ não conectado. Chame connect() antes.")
43
+
44
+ body = json.dumps(message).encode("utf-8")
45
+ await self.channel.default_exchange.publish(
46
+ aio_pika.Message(
47
+ body=body,
48
+ delivery_mode=aio_pika.DeliveryMode.PERSISTENT, # torna a msg persistente
49
+ ),
50
+ routing_key=self.queue,
51
+ )
52
+ print(f"✅ Mensagem publicada na fila '{self.queue}': {message}")
53
+
54
+ async def close(self):
55
+ if self.connection:
56
+ await self.connection.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.26
3
+ Version: 0.1.28
4
4
  Summary: Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ
5
5
  Author-email: Jhonatan Azevedo <dev.azevedo@outlook.com>
6
6
  Project-URL: Homepage, https://github.com/seu-usuario/libretificacaotjcore
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Operating System :: OS Independent
22
22
  Requires-Python: >=3.12
23
23
  Description-Content-Type: text/markdown
24
+ Requires-Dist: aio-pika>=9.5.7
24
25
  Requires-Dist: aiofiles>=24.1.0
25
26
  Requires-Dist: boto3>=1.39.16
26
27
  Requires-Dist: cryptography>=45.0.6
@@ -1,3 +1,4 @@
1
+ aio-pika>=9.5.7
1
2
  aiofiles>=24.1.0
2
3
  boto3>=1.39.16
3
4
  cryptography>=45.0.6
@@ -1,48 +1,49 @@
1
- [build-system]
2
- build-backend = "setuptools.build_meta"
3
- requires = ["setuptools>=61.0", "wheel"]
4
-
5
- [project]
6
- authors = [
7
- {name = "Jhonatan Azevedo", email = "dev.azevedo@outlook.com"},
8
- ]
9
- description = "Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ"
10
- keywords = ["tj", "tributo justo", "retificação", "automação", "pydantic", "rabbitmq", "boto3", "motor"]
11
- name = "libretificacaotjcore"
12
- readme = "README.md"
13
- requires-python = ">=3.12"
14
- version = "0.1.26"
15
-
16
- classifiers = [
17
- "Development Status :: 3 - Alpha",
18
- "Intended Audience :: Developers",
19
- "Topic :: Software Development :: Libraries",
20
- "License :: OSI Approved :: MIT License",
21
- "Programming Language :: Python :: 3",
22
- "Programming Language :: Python :: 3.8",
23
- "Programming Language :: Python :: 3.9",
24
- "Programming Language :: Python :: 3.10",
25
- "Programming Language :: Python :: 3.11",
26
- "Programming Language :: Python :: 3.12",
27
- "Programming Language :: Python :: 3.13",
28
- "Operating System :: OS Independent",
29
- ]
30
-
31
- dependencies = [
32
- "aiofiles>=24.1.0",
33
- "boto3>=1.39.16",
34
- "cryptography>=45.0.6",
35
- "motor>=3.7.1",
36
- "pika>=1.3.2",
37
- "py7zr>=1.0.0",
38
- "pydantic>=2.11.7",
39
- ]
40
-
41
- [project.urls]
42
- Homepage = "https://github.com/seu-usuario/libretificacaotjcore"
43
- Issues = "https://github.com/seu-usuario/libretificacaotjcore/issues"
44
- Repository = "https://github.com/seu-usuario/libretificacaotjcore"
45
-
46
- [tool.setuptools.packages.find]
47
- include = ["libretificacaotjcore*"]
48
- where = ["."]
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = ["setuptools>=61.0", "wheel"]
4
+
5
+ [project]
6
+ authors = [
7
+ {name = "Jhonatan Azevedo", email = "dev.azevedo@outlook.com"},
8
+ ]
9
+ description = "Biblioteca para centralizar conexao com filas no rabbit e banco de dados no mongodb para os servicos de retificacao da TJ"
10
+ keywords = ["tj", "tributo justo", "retificação", "automação", "pydantic", "rabbitmq", "boto3", "motor"]
11
+ name = "libretificacaotjcore"
12
+ readme = "README.md"
13
+ requires-python = ">=3.12"
14
+ version = "0.1.28"
15
+
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Topic :: Software Development :: Libraries",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Operating System :: OS Independent",
29
+ ]
30
+
31
+ dependencies = [
32
+ "aio-pika>=9.5.7",
33
+ "aiofiles>=24.1.0",
34
+ "boto3>=1.39.16",
35
+ "cryptography>=45.0.6",
36
+ "motor>=3.7.1",
37
+ "pika>=1.3.2",
38
+ "py7zr>=1.0.0",
39
+ "pydantic>=2.11.7",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/seu-usuario/libretificacaotjcore"
44
+ Issues = "https://github.com/seu-usuario/libretificacaotjcore/issues"
45
+ Repository = "https://github.com/seu-usuario/libretificacaotjcore"
46
+
47
+ [tool.setuptools.packages.find]
48
+ include = ["libretificacaotjcore*"]
49
+ where = ["."]
@@ -1,52 +0,0 @@
1
- import pika
2
- import json
3
-
4
- class RabbitMQPublisher:
5
- def __init__(
6
- self,
7
- host,
8
- queue,
9
- username,
10
- password,
11
- vhost="/",
12
- ):
13
- self.host = host
14
- self.queue = queue
15
- self.username = username
16
- self.password = password
17
- self.vhost = vhost
18
- self.connection = None
19
- self.channel = None
20
-
21
- def connect(self):
22
- credentials = pika.PlainCredentials(self.username, self.password)
23
- parameters = pika.ConnectionParameters(
24
- host=self.host,
25
- credentials=credentials,
26
- virtual_host=self.vhost,
27
- heartbeat=60,
28
- blocked_connection_timeout=300,
29
- )
30
-
31
- self.connection = pika.BlockingConnection(parameters)
32
- self.channel = self.connection.channel()
33
- self.channel.queue_declare(queue=self.queue, durable=True)
34
-
35
- def publish(self, message: dict):
36
- if not self.channel:
37
- raise RuntimeError("❌ Canal RabbitMQ não conectado. Chame connect() antes.")
38
-
39
- body = json.dumps(message)
40
- self.channel.basic_publish(
41
- exchange="",
42
- routing_key=self.queue,
43
- body=body,
44
- properties=pika.BasicProperties(
45
- delivery_mode=2 # torna a mensagem persistente
46
- )
47
- )
48
- print(f"✅ Mensagem publicada na fila '{self.queue}': {message}")
49
-
50
- def close(self):
51
- if self.connection:
52
- self.connection.close()