libretificacaotjcore 0.1.27__tar.gz → 0.1.29__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.
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/PKG-INFO +3 -1
- libretificacaotjcore-0.1.29/libretificacaotjcore/services/rabbitmq_publisher.py +56 -0
- libretificacaotjcore-0.1.29/libretificacaotjcore/services/request_servico_api.py +15 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/PKG-INFO +3 -1
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/SOURCES.txt +1 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/requires.txt +2 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/pyproject.toml +50 -48
- libretificacaotjcore-0.1.27/libretificacaotjcore/services/rabbitmq_publisher.py +0 -53
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/README.md +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/__init__.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/database/__init__.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/database/arquivo_repository.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/database/certificado_repository.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/database/config_db.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/database/protocolo_repository.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/dtos/__init__.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/dtos/arquivo_dto.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/dtos/solicitacao_dto.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/enums/__init__.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/enums/e_eventos.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/services/__init__.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/services/crypto_pass_service.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/services/file_service.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/services/rabbitmq_consumer.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/services/s3_service.py +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/dependency_links.txt +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/top_level.txt +0 -0
- {libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libretificacaotjcore
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.29
|
|
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,9 +21,11 @@ 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
|
|
28
|
+
Requires-Dist: httpx>=0.28.1
|
|
27
29
|
Requires-Dist: motor>=3.7.1
|
|
28
30
|
Requires-Dist: pika>=1.3.2
|
|
29
31
|
Requires-Dist: py7zr>=1.0.0
|
|
@@ -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()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
|
|
3
|
+
class RequestServicoApi:
|
|
4
|
+
def __init__(self, url, token):
|
|
5
|
+
self.url = url
|
|
6
|
+
self.token = token
|
|
7
|
+
|
|
8
|
+
async def handler(self, *, mensagem_atualizacao: dict):
|
|
9
|
+
async with httpx.AsyncClient() as client:
|
|
10
|
+
response = await client.post(self.url, headers={"Authorization": f"Bearer {self.token}"}, json=mensagem_atualizacao)
|
|
11
|
+
|
|
12
|
+
if response.status_code != 200:
|
|
13
|
+
raise Exception(f"Erro ao fazer request ao servico de API: {response.status_code}")
|
|
14
|
+
|
|
15
|
+
return response.json()
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: libretificacaotjcore
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.29
|
|
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,9 +21,11 @@ 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
|
|
28
|
+
Requires-Dist: httpx>=0.28.1
|
|
27
29
|
Requires-Dist: motor>=3.7.1
|
|
28
30
|
Requires-Dist: pika>=1.3.2
|
|
29
31
|
Requires-Dist: py7zr>=1.0.0
|
|
@@ -21,4 +21,5 @@ libretificacaotjcore/services/crypto_pass_service.py
|
|
|
21
21
|
libretificacaotjcore/services/file_service.py
|
|
22
22
|
libretificacaotjcore/services/rabbitmq_consumer.py
|
|
23
23
|
libretificacaotjcore/services/rabbitmq_publisher.py
|
|
24
|
+
libretificacaotjcore/services/request_servico_api.py
|
|
24
25
|
libretificacaotjcore/services/s3_service.py
|
|
@@ -1,48 +1,50 @@
|
|
|
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.
|
|
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
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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.29"
|
|
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
|
+
"httpx>=0.28.1",
|
|
37
|
+
"motor>=3.7.1",
|
|
38
|
+
"pika>=1.3.2",
|
|
39
|
+
"py7zr>=1.0.0",
|
|
40
|
+
"pydantic>=2.11.7",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.urls]
|
|
44
|
+
Homepage = "https://github.com/seu-usuario/libretificacaotjcore"
|
|
45
|
+
Issues = "https://github.com/seu-usuario/libretificacaotjcore/issues"
|
|
46
|
+
Repository = "https://github.com/seu-usuario/libretificacaotjcore"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
include = ["libretificacaotjcore*"]
|
|
50
|
+
where = ["."]
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import pika
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
class RabbitMQPublisher:
|
|
5
|
-
def __init__(
|
|
6
|
-
self,
|
|
7
|
-
host: str,
|
|
8
|
-
queue: str,
|
|
9
|
-
username: str,
|
|
10
|
-
password: str,
|
|
11
|
-
vhost: str = "/",
|
|
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
|
-
self.connect()
|
|
21
|
-
|
|
22
|
-
def connect(self):
|
|
23
|
-
credentials = pika.PlainCredentials(self.username, self.password)
|
|
24
|
-
parameters = pika.ConnectionParameters(
|
|
25
|
-
host=self.host,
|
|
26
|
-
credentials=credentials,
|
|
27
|
-
virtual_host=self.vhost,
|
|
28
|
-
heartbeat=60,
|
|
29
|
-
blocked_connection_timeout=300,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
self.connection = pika.BlockingConnection(parameters)
|
|
33
|
-
self.channel = self.connection.channel()
|
|
34
|
-
self.channel.queue_declare(queue=self.queue, durable=True)
|
|
35
|
-
|
|
36
|
-
def publish(self, message: dict):
|
|
37
|
-
if not self.channel:
|
|
38
|
-
raise RuntimeError("❌ Canal RabbitMQ não conectado. Chame connect() antes.")
|
|
39
|
-
|
|
40
|
-
body = json.dumps(message)
|
|
41
|
-
self.channel.basic_publish(
|
|
42
|
-
exchange="",
|
|
43
|
-
routing_key=self.queue,
|
|
44
|
-
body=body,
|
|
45
|
-
properties=pika.BasicProperties(
|
|
46
|
-
delivery_mode=2 # torna a mensagem persistente
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
print(f"✅ Mensagem publicada na fila '{self.queue}': {message}")
|
|
50
|
-
|
|
51
|
-
def close(self):
|
|
52
|
-
if self.connection:
|
|
53
|
-
self.connection.close()
|
|
File without changes
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/dtos/__init__.py
RENAMED
|
File without changes
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/dtos/arquivo_dto.py
RENAMED
|
File without changes
|
|
File without changes
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/enums/__init__.py
RENAMED
|
File without changes
|
{libretificacaotjcore-0.1.27 → libretificacaotjcore-0.1.29}/libretificacaotjcore/enums/e_eventos.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|