csc-cia-stne 0.0.81__tar.gz → 0.0.83__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.
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/PKG-INFO +1 -1
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/pyproject.toml +1 -1
- csc_cia_stne-0.0.83/src/csc_cia_stne/utilitarios/functions/func_get_secret.py +77 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne.egg-info/PKG-INFO +1 -1
- csc_cia_stne-0.0.81/src/csc_cia_stne/utilitarios/functions/func_get_secret.py +0 -67
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/LICENCE +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/README.md +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/README_PYPI.md +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/setup.cfg +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/__init__.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/bc_correios.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/bc_sta.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/email.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/gcp_bigquery.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/google_drive.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/karavela.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/logger_json.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/logger_rich.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/provio.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/servicenow.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/slack.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/stne_admin.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/__init__.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/__init__.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_b64.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_converters.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_rdp.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_recriar_pastas.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_settings.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_titulo.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/ServiceNowValidator.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/__init__.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/web_validator.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/web.py +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne.egg-info/SOURCES.txt +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne.egg-info/dependency_links.txt +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne.egg-info/requires.txt +0 -0
- {csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "csc_cia_stne"
|
7
|
-
version = "0.0.
|
7
|
+
version = "0.0.83"
|
8
8
|
license = { text = "MIT" }
|
9
9
|
description = "Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs"
|
10
10
|
keywords = ["karavela", "csc", "cia", "stone", "rpa", "botcity", "stne"]
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import os
|
2
|
+
from botcity.maestro import *
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
def get_secret(name: str, maestro: Optional[BotMaestroSDK] = None, activity_label: Optional[str] = None) -> str:
|
6
|
+
"""
|
7
|
+
Obtém um segredo a partir de diferentes fontes, como variáveis de ambiente, arquivos locais ou o BotMaestroSDK.
|
8
|
+
Args:
|
9
|
+
name (str): O nome do segredo a ser recuperado.
|
10
|
+
maestro (Optional[BotMaestroSDK]): Instância opcional do BotMaestroSDK para buscar o segredo.
|
11
|
+
activity_label (Optional[str]): Rótulo opcional de atividade para buscar o segredo no BotMaestroSDK.
|
12
|
+
Returns:
|
13
|
+
str: O valor do segredo recuperado. Retorna `None` se o segredo não for encontrado.
|
14
|
+
Comportamento:
|
15
|
+
1. Primeiro tenta recuperar o segredo a partir de uma variável de ambiente.
|
16
|
+
2. Caso não encontre, verifica em diferentes diretórios locais:
|
17
|
+
- ./secrets
|
18
|
+
- ./.secrets
|
19
|
+
- ./private
|
20
|
+
- ./.private
|
21
|
+
- /secrets
|
22
|
+
3. Se o segredo ainda não for encontrado, tenta buscar no BotMaestroSDK, utilizando o rótulo de atividade, se fornecido.
|
23
|
+
Exceções:
|
24
|
+
- Caso ocorra algum erro ao buscar o segredo no BotMaestroSDK, o segredo será definido como `None`.
|
25
|
+
"""
|
26
|
+
# Tentando extrair da variavel de ambiente
|
27
|
+
secret = os.getenv(name)
|
28
|
+
|
29
|
+
# secret não encontrada em variavel de ambiente, tentando extrair do arquivo em /secret
|
30
|
+
if secret is None:
|
31
|
+
|
32
|
+
# verifica na pasta ./secrets
|
33
|
+
if os.path.exists(f"./secrets/{name}"):
|
34
|
+
|
35
|
+
with open(f"./secrets/{name}",'r') as secret_file:
|
36
|
+
|
37
|
+
secret = secret_file.read()
|
38
|
+
|
39
|
+
# verifica na pasta ./.secrets
|
40
|
+
elif os.path.exists(f"./.secrets/{name}"):
|
41
|
+
|
42
|
+
with open(f"./.secrets/{name}",'r') as secret_file:
|
43
|
+
|
44
|
+
secret = secret_file.read()
|
45
|
+
|
46
|
+
# verifica na pasta ./private
|
47
|
+
elif os.path.exists(f"./private/{name}"):
|
48
|
+
|
49
|
+
with open(f"./private/{name}",'r') as secret_file:
|
50
|
+
|
51
|
+
secret = secret_file.read()
|
52
|
+
|
53
|
+
# verifica na pasta ./.private
|
54
|
+
elif os.path.exists(f"./.private/{name}"):
|
55
|
+
|
56
|
+
with open(f"./.private/{name}",'r') as secret_file:
|
57
|
+
|
58
|
+
secret = secret_file.read()
|
59
|
+
|
60
|
+
# verifica na pasta /secrets
|
61
|
+
elif os.path.exists(f"/secrets/{name}"):
|
62
|
+
|
63
|
+
with open(f"/secrets/{name}",'r') as secret_file:
|
64
|
+
|
65
|
+
secret = secret_file.read()
|
66
|
+
|
67
|
+
elif maestro and isinstance(maestro, BotMaestroSDK):
|
68
|
+
try:
|
69
|
+
if activity_label and isinstance(activity_label, str):
|
70
|
+
secret = maestro.get_credential(label=activity_label, key=name)
|
71
|
+
else:
|
72
|
+
secret = maestro.get_credential(label=name, key=name)
|
73
|
+
|
74
|
+
except Exception as e:
|
75
|
+
secret = None
|
76
|
+
|
77
|
+
return secret
|
@@ -1,67 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from botcity.maestro import *
|
3
|
-
from typing import Optional
|
4
|
-
|
5
|
-
def get_secret(name: str, maestro: Optional[BotMaestroSDK] = None) -> str:
|
6
|
-
"""
|
7
|
-
Extrai a secret do ambiente
|
8
|
-
|
9
|
-
Args:
|
10
|
-
name (str): nome da variavel ou arquivo da secret
|
11
|
-
maestro ( Optional[BotMaestroSDK]): Recebe o Maestro da Botcity. e opcional.
|
12
|
-
|
13
|
-
Returns:
|
14
|
-
str: string da secret armazenada na variável de ambiente ou no arquivo de secret
|
15
|
-
"""
|
16
|
-
|
17
|
-
# Tentando extrair da variavel de ambiente
|
18
|
-
secret = os.getenv(name)
|
19
|
-
|
20
|
-
# secret não encontrada em variavel de ambiente, tentando extrair do arquivo em /secret
|
21
|
-
if secret is None:
|
22
|
-
|
23
|
-
# verifica na pasta ./secrets
|
24
|
-
if os.path.exists(f"./secrets/{name}"):
|
25
|
-
|
26
|
-
with open(f"./secrets/{name}",'r') as secret_file:
|
27
|
-
|
28
|
-
secret = secret_file.read()
|
29
|
-
|
30
|
-
# verifica na pasta ./.secrets
|
31
|
-
elif os.path.exists(f"./.secrets/{name}"):
|
32
|
-
|
33
|
-
with open(f"./.secrets/{name}",'r') as secret_file:
|
34
|
-
|
35
|
-
secret = secret_file.read()
|
36
|
-
|
37
|
-
# verifica na pasta ./private
|
38
|
-
elif os.path.exists(f"./private/{name}"):
|
39
|
-
|
40
|
-
with open(f"./private/{name}",'r') as secret_file:
|
41
|
-
|
42
|
-
secret = secret_file.read()
|
43
|
-
|
44
|
-
# verifica na pasta ./.private
|
45
|
-
elif os.path.exists(f"./.private/{name}"):
|
46
|
-
|
47
|
-
with open(f"./.private/{name}",'r') as secret_file:
|
48
|
-
|
49
|
-
secret = secret_file.read()
|
50
|
-
|
51
|
-
# verifica na pasta /secrets
|
52
|
-
elif os.path.exists(f"/secrets/{name}"):
|
53
|
-
|
54
|
-
with open(f"/secrets/{name}",'r') as secret_file:
|
55
|
-
|
56
|
-
secret = secret_file.read()
|
57
|
-
|
58
|
-
elif maestro and isinstance(maestro, BotMaestroSDK):
|
59
|
-
try:
|
60
|
-
|
61
|
-
secret = maestro.get_credential(label=name, key=name)
|
62
|
-
|
63
|
-
except Exception as e:
|
64
|
-
|
65
|
-
secret = None
|
66
|
-
|
67
|
-
return secret
|
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
|
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
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/__init__.py
RENAMED
File without changes
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_b64.py
RENAMED
File without changes
|
File without changes
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_rdp.py
RENAMED
File without changes
|
File without changes
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_settings.py
RENAMED
File without changes
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/functions/func_titulo.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{csc_cia_stne-0.0.81 → csc_cia_stne-0.0.83}/src/csc_cia_stne/utilitarios/validations/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|