csc-cia-stne 0.0.20__py3-none-any.whl → 0.0.21__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.
- csc_cia_stne/__init__.py +4 -1
- csc_cia_stne/logger_rich.py +4 -0
- {csc_cia_stne-0.0.20.dist-info → csc_cia_stne-0.0.21.dist-info}/METADATA +1 -1
- {csc_cia_stne-0.0.20.dist-info → csc_cia_stne-0.0.21.dist-info}/RECORD +7 -8
- csc_cia_stne/settings.py +0 -49
- {csc_cia_stne-0.0.20.dist-info → csc_cia_stne-0.0.21.dist-info}/LICENCE +0 -0
- {csc_cia_stne-0.0.20.dist-info → csc_cia_stne-0.0.21.dist-info}/WHEEL +0 -0
- {csc_cia_stne-0.0.20.dist-info → csc_cia_stne-0.0.21.dist-info}/top_level.txt +0 -0
csc_cia_stne/__init__.py
CHANGED
csc_cia_stne/logger_rich.py
CHANGED
@@ -2,10 +2,14 @@ import logging
|
|
2
2
|
from rich.logging import RichHandler
|
3
3
|
from rich.theme import Theme
|
4
4
|
from rich.console import Console
|
5
|
+
from rich.traceback import install
|
5
6
|
import re
|
6
7
|
import traceback
|
7
8
|
import os
|
8
9
|
|
10
|
+
# Instala formatações de exception da biblioteca Rich
|
11
|
+
install()
|
12
|
+
|
9
13
|
# Definindo o nível de log baseado nas configurações
|
10
14
|
if os.getenv('log_level') is None:
|
11
15
|
|
@@ -1,17 +1,16 @@
|
|
1
|
-
csc_cia_stne/__init__.py,sha256=
|
1
|
+
csc_cia_stne/__init__.py,sha256=pSsv-mlFYxzKxloAXcaXlXW4XeqQ9w90yQWom08TobQ,511
|
2
2
|
csc_cia_stne/bc_correios.py,sha256=ANsvLyL7wdkM0MvjjBHB2Ih4eyTcyWgt5IqiK0Rv89E,23014
|
3
3
|
csc_cia_stne/bc_sta.py,sha256=I9N29wjTbd4ZmoM2yIW-xp3X-dMENZdSb0JhapfCegY,10988
|
4
4
|
csc_cia_stne/functions.py,sha256=O3UCK2IX2uDC_cqgwr2Z0mLolVBOZaxLfd661tJxHLQ,4390
|
5
5
|
csc_cia_stne/gcp_bigquery.py,sha256=f8UEQgr6XyFacYX0bRq4UDmWoH-0XqZF8fA2LsLTtAU,5654
|
6
6
|
csc_cia_stne/karavela.py,sha256=Q7MbQXXz_jtrLHM7QeenbSzcro07EpoFk4lKglivJ_I,3564
|
7
7
|
csc_cia_stne/logger_json.py,sha256=2G0rm0lyCtHn4o2v7fzn4wMylb0A_nbxiQatnrSZxHs,1212
|
8
|
-
csc_cia_stne/logger_rich.py,sha256=
|
8
|
+
csc_cia_stne/logger_rich.py,sha256=yW1py7k5yY5Fay5I_eY-ulMGGSmFGGhUl3Q4U8aczbo,3392
|
9
9
|
csc_cia_stne/servicenow.py,sha256=vSsNSANFyCZtDu2O7YmdoCbr-_bO1sgMWnOI29mFBOA,23311
|
10
|
-
csc_cia_stne/settings.py,sha256=26Q9cYC1gGLrds8bDvowmol520-1GOt_8pziRd7nczY,1629
|
11
10
|
csc_cia_stne/stne_admin.py,sha256=G5ozXt18VjKL2BHtROQk4GnfVY1xM14RXSQ-rra_D54,15487
|
12
11
|
csc_cia_stne/utilitarios.py,sha256=LU8YrELiRIW4UxqULjiUPYmgbEx79NGenK5QKRdSh_E,2050
|
13
|
-
csc_cia_stne-0.0.
|
14
|
-
csc_cia_stne-0.0.
|
15
|
-
csc_cia_stne-0.0.
|
16
|
-
csc_cia_stne-0.0.
|
17
|
-
csc_cia_stne-0.0.
|
12
|
+
csc_cia_stne-0.0.21.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
|
13
|
+
csc_cia_stne-0.0.21.dist-info/METADATA,sha256=T28yy9m-4x8caBgwcpeqnqSlm-HqA6Xmc0m3kDMWte8,1003
|
14
|
+
csc_cia_stne-0.0.21.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
15
|
+
csc_cia_stne-0.0.21.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
|
16
|
+
csc_cia_stne-0.0.21.dist-info/RECORD,,
|
csc_cia_stne/settings.py
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
from pydantic_settings import BaseSettings
|
2
|
-
from pydantic import ValidationError
|
3
|
-
from rich.traceback import install
|
4
|
-
from dotenv import load_dotenv
|
5
|
-
from .functions import titulo
|
6
|
-
# Instala formatações de exception da biblioteca Rich
|
7
|
-
install()
|
8
|
-
|
9
|
-
# Carrega .env
|
10
|
-
load_dotenv()
|
11
|
-
|
12
|
-
# Classe para armazenar configurações
|
13
|
-
class Settings(BaseSettings):
|
14
|
-
# Ambiente de Execução
|
15
|
-
ambiente_de_execucao: str = "local"
|
16
|
-
log_level: str = "DEBUG"
|
17
|
-
|
18
|
-
# Titulo
|
19
|
-
project_name: str
|
20
|
-
project_version: str
|
21
|
-
project_dev_name: str
|
22
|
-
project_dev_mail: str
|
23
|
-
|
24
|
-
class Config:
|
25
|
-
env_file = ".env"
|
26
|
-
env_file_encoding = 'utf-8' # Defina a codificação se necessário
|
27
|
-
|
28
|
-
# Carrega as configurações do arquivo .env ou retorna exception com os campos obrigatórios que não foram preenchidos
|
29
|
-
def load_settings():
|
30
|
-
try:
|
31
|
-
settings = Settings()
|
32
|
-
return settings
|
33
|
-
|
34
|
-
except ValidationError as e:
|
35
|
-
# Extrair os detalhes da exceção
|
36
|
-
errors = e.errors()
|
37
|
-
missing_vars = [error['loc'][0] for error in errors if error['type'] == 'missing']
|
38
|
-
|
39
|
-
# Criar uma mensagem personalizada
|
40
|
-
if missing_vars:
|
41
|
-
missing_vars_str = ', '.join(missing_vars)
|
42
|
-
raise ValueError(
|
43
|
-
f"As seguintes variáveis obrigatórias estão ausentes no arquivo .env ou nas variáveis de ambiente da máquina: {missing_vars_str}\n"
|
44
|
-
"Outras variáveis, não obrigatórias: 'ambiente_de_execução' ('local' ou 'karavela') e 'log_level' ('DEBUG', 'INFO', etc)"
|
45
|
-
)
|
46
|
-
else:
|
47
|
-
titulo()
|
48
|
-
|
49
|
-
settings = load_settings()
|
File without changes
|
File without changes
|
File without changes
|