libretificacaotjcore 0.1.65__tar.gz → 0.1.75__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.
Files changed (34) hide show
  1. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/PKG-INFO +2 -2
  2. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/config_db.py +15 -1
  3. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/rabbitmq_consumer.py +3 -1
  4. libretificacaotjcore-0.1.75/libretificacaotjcore/services/request_servico_api.py +30 -0
  5. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore.egg-info/PKG-INFO +2 -2
  6. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/pyproject.toml +2 -2
  7. libretificacaotjcore-0.1.65/libretificacaotjcore/services/request_servico_api.py +0 -20
  8. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/README.md +0 -0
  9. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/__init__.py +0 -0
  10. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/__init__.py +0 -0
  11. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/arquivo_repository.py +0 -0
  12. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/certificado_repository.py +0 -0
  13. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/depentente_invalido_1210_repository.py +0 -0
  14. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/protocolo_repository.py +0 -0
  15. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/rubrica_repository.py +0 -0
  16. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/solicitacao_xml_repository.py +0 -0
  17. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/database/tempo_processo_repository.py +0 -0
  18. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/dtos/__init__.py +0 -0
  19. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/dtos/arquivo_dto.py +0 -0
  20. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/dtos/processo_dto.py +0 -0
  21. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/dtos/solicitacao_dto.py +0 -0
  22. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/enums/__init__.py +0 -0
  23. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/enums/e_eventos.py +0 -0
  24. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/enums/e_fase_retificacao.py +0 -0
  25. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/__init__.py +0 -0
  26. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/crypto_pass_service.py +0 -0
  27. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/file_service.py +0 -0
  28. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/rabbitmq_publisher.py +0 -0
  29. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore/services/s3_service.py +0 -0
  30. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore.egg-info/SOURCES.txt +0 -0
  31. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore.egg-info/dependency_links.txt +0 -0
  32. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore.egg-info/requires.txt +0 -0
  33. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/libretificacaotjcore.egg-info/top_level.txt +0 -0
  34. {libretificacaotjcore-0.1.65 → libretificacaotjcore-0.1.75}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.65
3
+ Version: 0.1.75
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
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Operating System :: OS Independent
22
- Requires-Python: >=3.12
22
+ Requires-Python: >=3.11
23
23
  Description-Content-Type: text/markdown
24
24
  Requires-Dist: aio-pika>=9.5.7
25
25
  Requires-Dist: aiofiles>=24.1.0
@@ -1,4 +1,5 @@
1
1
  import motor.motor_asyncio
2
+ import certifi
2
3
 
3
4
  class ConfigDb:
4
5
  def __init__(self, host: str, user: str, password: str, port: int, db_name: str):
@@ -8,8 +9,21 @@ class ConfigDb:
8
9
  self.port = port
9
10
  self.db_name = db_name
10
11
 
12
+ auth = f"{self.user}:{self.password}@" if self.user and self.password else ""
13
+ # self.client = motor.motor_asyncio.AsyncIOMotorClient(
14
+ # f"mongodb+srv://{auth}{self.host}",
15
+ # tls=True,
16
+ # tlsCAFile=certifi.where(),
17
+ # tlsAllowInvalidCertificates=False,
18
+ # serverSelectionTimeoutMS=30000,
19
+ # socketTimeoutMS=20000,
20
+ # connectTimeoutMS=20000,
21
+ # retryWrites=True,
22
+ # w='majority'
23
+ # )
24
+
11
25
  self.client = motor.motor_asyncio.AsyncIOMotorClient(
12
- f"mongodb://{self.host}:{self.port}"
26
+ f"mongodb://{auth}{self.host}:{self.port}/"
13
27
  )
14
28
  self.__db = self.client[self.db_name]
15
29
  self.db_initialized = False
@@ -11,6 +11,7 @@ class RabbitMQConsumer:
11
11
  username: str,
12
12
  password: str,
13
13
  vhost: str = "/",
14
+ prefetch_count: int = 1
14
15
  ):
15
16
  self.host = host
16
17
  self.queue = queue
@@ -19,6 +20,7 @@ class RabbitMQConsumer:
19
20
  self.vhost = vhost
20
21
  self.connection = None
21
22
  self.channel = None
23
+ self.prefetch_count = prefetch_count
22
24
 
23
25
  async def connect(self):
24
26
  self.connection = await aio_pika.connect_robust(
@@ -29,7 +31,7 @@ class RabbitMQConsumer:
29
31
  heartbeat=600,
30
32
  )
31
33
  self.channel = await self.connection.channel()
32
- await self.channel.set_qos(prefetch_count=1)
34
+ await self.channel.set_qos(prefetch_count=self.prefetch_count)
33
35
  await self.channel.declare_queue(self.queue, durable=True)
34
36
 
35
37
  async def start_consuming(self, callback):
@@ -0,0 +1,30 @@
1
+ import httpx
2
+
3
+
4
+ class RequestServicoApi:
5
+ def __init__(self, url, token):
6
+ self.url = url
7
+ self.token = token
8
+ self.client = httpx.AsyncClient(timeout=1200, verify=False)
9
+ self.status_code_success = [200, 201, 204]
10
+
11
+ async def post(self, *, data: dict | list):
12
+ print(self.token)
13
+ response = await self.client.post(self.url, json=data)
14
+
15
+ if response.status_code not in self.status_code_success:
16
+ raise Exception(f"Erro ao fazer request ao servico de API: {response.status_code}")
17
+
18
+ await self.close()
19
+
20
+ async def get(self):
21
+ response = await self.client.get(self.url)
22
+
23
+ if response.status_code not in self.status_code_success:
24
+ raise Exception(f"Erro ao fazer request ao servico de API: {response.status_code}")
25
+
26
+ await self.close()
27
+ return response.json()
28
+
29
+ async def close(self):
30
+ await self.client.aclose()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libretificacaotjcore
3
- Version: 0.1.65
3
+ Version: 0.1.75
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
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Operating System :: OS Independent
22
- Requires-Python: >=3.12
22
+ Requires-Python: >=3.11
23
23
  Description-Content-Type: text/markdown
24
24
  Requires-Dist: aio-pika>=9.5.7
25
25
  Requires-Dist: aiofiles>=24.1.0
@@ -17,8 +17,8 @@ keywords = [
17
17
  ]
18
18
  name = "libretificacaotjcore"
19
19
  readme = "README.md"
20
- requires-python = ">=3.12"
21
- version = "0.1.65"
20
+ requires-python = ">=3.11"
21
+ version = "0.1.75"
22
22
 
23
23
  classifiers = [
24
24
  "Development Status :: 3 - Alpha",
@@ -1,20 +0,0 @@
1
- import httpx
2
-
3
-
4
- class RequestServicoApi:
5
- def __init__(self, url, token):
6
- self.url = url
7
- self.token = token
8
- self.client = httpx.AsyncClient(timeout=120, verify=False)
9
-
10
- async def handler(self, *, mensagem_atualizacao: dict):
11
- print(self.token)
12
- response = await self.client.post(self.url, json=mensagem_atualizacao)
13
-
14
- if response.status_code != 200:
15
- raise Exception(f"Erro ao fazer request ao servico de API: {response.status_code}")
16
-
17
- await self.close()
18
-
19
- async def close(self):
20
- await self.client.aclose()