csc-cia-stne 0.0.43__py3-none-any.whl → 0.0.45__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- csc_cia_stne/__init__.py +4 -4
- csc_cia_stne/logger_json.py +4 -4
- csc_cia_stne/logger_rich.py +2 -2
- csc_cia_stne/provio.py +3 -1
- {csc_cia_stne-0.0.43.dist-info → csc_cia_stne-0.0.45.dist-info}/METADATA +1 -1
- {csc_cia_stne-0.0.43.dist-info → csc_cia_stne-0.0.45.dist-info}/RECORD +9 -9
- {csc_cia_stne-0.0.43.dist-info → csc_cia_stne-0.0.45.dist-info}/LICENCE +0 -0
- {csc_cia_stne-0.0.43.dist-info → csc_cia_stne-0.0.45.dist-info}/WHEEL +0 -0
- {csc_cia_stne-0.0.43.dist-info → csc_cia_stne-0.0.45.dist-info}/top_level.txt +0 -0
csc_cia_stne/__init__.py
CHANGED
@@ -62,7 +62,7 @@ def _running_in_container():
|
|
62
62
|
|
63
63
|
return False
|
64
64
|
|
65
|
-
def logger():
|
65
|
+
def logger(nome:str='__main__'):
|
66
66
|
"""
|
67
67
|
Retorna um objeto logger com base no ambiente de execução.
|
68
68
|
Se a variável de ambiente 'ambiente_de_execucao' estiver definida e for igual a "karavela",
|
@@ -78,12 +78,12 @@ def logger():
|
|
78
78
|
|
79
79
|
if os.getenv('ambiente_de_execucao') is not None and os.getenv('ambiente_de_execucao') == "karavela":
|
80
80
|
|
81
|
-
return get_logger_json()
|
81
|
+
return get_logger_json(nome)
|
82
82
|
|
83
83
|
elif _running_in_container():
|
84
84
|
|
85
|
-
return get_logger_json()
|
85
|
+
return get_logger_json(nome)
|
86
86
|
|
87
87
|
else:
|
88
88
|
|
89
|
-
return get_logger_rich()
|
89
|
+
return get_logger_rich(nome)
|
csc_cia_stne/logger_json.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
from pythonjsonlogger import jsonlogger
|
3
3
|
|
4
|
-
def setup_json_logger():
|
4
|
+
def setup_json_logger(nome):
|
5
5
|
|
6
6
|
def add_log_level(level_name, level_num, method_name=None):
|
7
7
|
"""
|
@@ -45,7 +45,7 @@ def setup_json_logger():
|
|
45
45
|
|
46
46
|
if not 'SUCCESS' in logging._nameToLevel:
|
47
47
|
add_log_level("SUCCESS",21)
|
48
|
-
logger = logging.getLogger(
|
48
|
+
logger = logging.getLogger(nome)
|
49
49
|
logger.setLevel(logging.INFO)
|
50
50
|
|
51
51
|
# Remove handlers anteriores, se houver
|
@@ -78,7 +78,7 @@ def setup_json_logger():
|
|
78
78
|
# Chama a função para configurar o logger
|
79
79
|
#logger = setup_json_logger()
|
80
80
|
|
81
|
-
def get_logger():
|
81
|
+
def get_logger(nome):
|
82
82
|
"""
|
83
83
|
logger = logging.getLogger("my_json_logger")
|
84
84
|
if not logger.hasHandlers(): # Evita configurar múltiplas vezes
|
@@ -88,5 +88,5 @@ def get_logger():
|
|
88
88
|
logger.setLevel(logging.DEBUG)
|
89
89
|
logger.addHandler(handler)
|
90
90
|
"""
|
91
|
-
logger = setup_json_logger()
|
91
|
+
logger = setup_json_logger(nome)
|
92
92
|
return logger
|
csc_cia_stne/logger_rich.py
CHANGED
@@ -115,7 +115,7 @@ logger = logging.getLogger()
|
|
115
115
|
|
116
116
|
"""
|
117
117
|
|
118
|
-
def get_logger():
|
118
|
+
def get_logger(nome):
|
119
119
|
"""
|
120
120
|
Retorna um objeto logger configurado com base nas variáveis de ambiente.
|
121
121
|
Returns:
|
@@ -238,7 +238,7 @@ def get_logger():
|
|
238
238
|
if not 'SUCCESS' in logging._nameToLevel:
|
239
239
|
add_log_level("SUCCESS",21)
|
240
240
|
|
241
|
-
logger = logging.getLogger(
|
241
|
+
logger = logging.getLogger(nome)
|
242
242
|
|
243
243
|
# Sendo setado aqui pois no basicConfig estava gerando logs para as libs do slack_sdk e big query
|
244
244
|
|
csc_cia_stne/provio.py
CHANGED
@@ -4,6 +4,8 @@ from requests.auth import HTTPBasicAuth
|
|
4
4
|
from pydantic import BaseModel, Field, ValidationError
|
5
5
|
from typing import List, Dict, Union
|
6
6
|
|
7
|
+
log = logging.getLogger('__main__')
|
8
|
+
|
7
9
|
# Validadores
|
8
10
|
class ProvioModel(BaseModel):
|
9
11
|
"""
|
@@ -90,7 +92,7 @@ class Provio:
|
|
90
92
|
skip += 500
|
91
93
|
requisicao += 1
|
92
94
|
if verbose:
|
93
|
-
|
95
|
+
log.info(f"Exportando relatório: Requisição #{str(requisicao).zfill(3)}: {len(todos_os_dados)} registros no total")
|
94
96
|
|
95
97
|
else:
|
96
98
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
csc_cia_stne/__init__.py,sha256=
|
1
|
+
csc_cia_stne/__init__.py,sha256=lHYOTmSOu5K-G1lKYKqrK1evkjOW1WTAxSHjWHk99-k,2466
|
2
2
|
csc_cia_stne/bc_correios.py,sha256=pQAnRrcXEMrx3N1MWydZVIhEQLerh3x8-0B045zZIzk,24174
|
3
3
|
csc_cia_stne/bc_sta.py,sha256=f75HJ7FLIDSJFLDTvvSvCYo9z0HchzP7rDY5WIdiKXY,16830
|
4
4
|
csc_cia_stne/email.py,sha256=RK_TzWBVnUfpP-s5NvjTJJjzhICy8e2fME9EuaiySMY,8162
|
5
5
|
csc_cia_stne/gcp_bigquery.py,sha256=jYxvqrWDOPkxc05U4aef7V5lL8ptqsE93lfn0dLFyvc,7385
|
6
6
|
csc_cia_stne/google_drive.py,sha256=JcXKlRBSxf5CKM-alT4ZpqWVWLZQfIYIX42_nENoTgU,11896
|
7
7
|
csc_cia_stne/karavela.py,sha256=LlpFiDu0ww7eh8F-oREWSQo2mVoQMibx0EGiHR6tznI,4231
|
8
|
-
csc_cia_stne/logger_json.py,sha256=
|
9
|
-
csc_cia_stne/logger_rich.py,sha256=
|
10
|
-
csc_cia_stne/provio.py,sha256=
|
8
|
+
csc_cia_stne/logger_json.py,sha256=CXxSCOFGMymDi8XE9SKnPKjW4D0wJLqDLnxqePS26i8,3187
|
9
|
+
csc_cia_stne/logger_rich.py,sha256=9gr-g7kGnL9K88hLukso8RddywPt9rP2PK4E4rIeIwQ,8137
|
10
|
+
csc_cia_stne/provio.py,sha256=G-pDnHYLSp97joc7S7dvwjNvl3omnTmvdi3rOPQf5GA,3987
|
11
11
|
csc_cia_stne/servicenow.py,sha256=3eifPWOIGv2udGpI3cr2SkMMKcQR4xHlA_fiOdw_fmg,32136
|
12
12
|
csc_cia_stne/slack.py,sha256=33_UNF7M529eIuWjmzSJFEZ4RmVNkFkuVxvxwsKY1tQ,8126
|
13
13
|
csc_cia_stne/stne_admin.py,sha256=vnGSEzcmqWE42vg71oEuoRg6ENaGsZsXFOjxduSH4KU,23561
|
@@ -22,8 +22,8 @@ csc_cia_stne/utilitarios/validations/GcpBigQueryValidator.py,sha256=PfCeeQquheZk
|
|
22
22
|
csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py,sha256=PBo-AV2bjR__4o9jYxuXO-UyxjAZvVwYgMbtsrFK2sI,4537
|
23
23
|
csc_cia_stne/utilitarios/validations/ServiceNowValidator.py,sha256=yleKUIo1ZfyloP9fDPNjv3JJXdLcocT81WIgRSYmqEA,14423
|
24
24
|
csc_cia_stne/utilitarios/validations/__init__.py,sha256=O_qyEU2ji3u6LHUXZCXvUFsMpoMWL625qqHTXyXivTA,106
|
25
|
-
csc_cia_stne-0.0.
|
26
|
-
csc_cia_stne-0.0.
|
27
|
-
csc_cia_stne-0.0.
|
28
|
-
csc_cia_stne-0.0.
|
29
|
-
csc_cia_stne-0.0.
|
25
|
+
csc_cia_stne-0.0.45.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
|
26
|
+
csc_cia_stne-0.0.45.dist-info/METADATA,sha256=W9ajMJh0JbHTfE4prkW21MoxeNG0K4PW5M8dkIC7LA4,1121
|
27
|
+
csc_cia_stne-0.0.45.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
28
|
+
csc_cia_stne-0.0.45.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
|
29
|
+
csc_cia_stne-0.0.45.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|