csc-cia-stne 0.0.41__py3-none-any.whl → 0.0.42__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/logger_json.py +2 -1
- csc_cia_stne/logger_rich.py +2 -1
- csc_cia_stne/slack.py +11 -11
- {csc_cia_stne-0.0.41.dist-info → csc_cia_stne-0.0.42.dist-info}/METADATA +2 -2
- {csc_cia_stne-0.0.41.dist-info → csc_cia_stne-0.0.42.dist-info}/RECORD +8 -8
- {csc_cia_stne-0.0.41.dist-info → csc_cia_stne-0.0.42.dist-info}/WHEEL +1 -1
- {csc_cia_stne-0.0.41.dist-info → csc_cia_stne-0.0.42.dist-info}/LICENCE +0 -0
- {csc_cia_stne-0.0.41.dist-info → csc_cia_stne-0.0.42.dist-info}/top_level.txt +0 -0
csc_cia_stne/logger_json.py
CHANGED
@@ -43,7 +43,8 @@ def setup_json_logger():
|
|
43
43
|
setattr(logging.getLoggerClass(), method_name, log_for_level)
|
44
44
|
setattr(logging, method_name, log_to_root)
|
45
45
|
|
46
|
-
|
46
|
+
if not 'SUCCESS' in logging._nameToLevel:
|
47
|
+
add_log_level("SUCCESS",21)
|
47
48
|
logger = logging.getLogger(__name__)
|
48
49
|
logger.setLevel(logging.INFO)
|
49
50
|
|
csc_cia_stne/logger_rich.py
CHANGED
@@ -234,7 +234,8 @@ def get_logger():
|
|
234
234
|
setattr(logging.getLoggerClass(), method_name, log_for_level)
|
235
235
|
setattr(logging, method_name, log_to_root)
|
236
236
|
|
237
|
-
|
237
|
+
if not 'SUCCESS' in logging._nameToLevel:
|
238
|
+
add_log_level("SUCCESS",21)
|
238
239
|
|
239
240
|
logger = logging.getLogger(__name__)
|
240
241
|
|
csc_cia_stne/slack.py
CHANGED
@@ -84,7 +84,7 @@ class SendSlackMessageParamsValidator(BaseModel):
|
|
84
84
|
|
85
85
|
message:str
|
86
86
|
highlights:list
|
87
|
-
|
87
|
+
file_list:list
|
88
88
|
|
89
89
|
@field_validator('message')
|
90
90
|
def validate_message(cls, value, info):
|
@@ -92,7 +92,7 @@ class SendSlackMessageParamsValidator(BaseModel):
|
|
92
92
|
raise ValueError(f"O campo '{info.field_name}' deve ser strings e não {type(value)}")
|
93
93
|
return value
|
94
94
|
|
95
|
-
@field_validator('highlights','
|
95
|
+
@field_validator('highlights','file_list')
|
96
96
|
def validate_list(cls, value, info):
|
97
97
|
if not isinstance(value, list):
|
98
98
|
raise ValueError(f"O campo '{info.field_name}' deve ser strings e não {type(value)}")
|
@@ -129,7 +129,7 @@ class Slack():
|
|
129
129
|
self.client = WebClient(self.token_slack)
|
130
130
|
|
131
131
|
|
132
|
-
def send_message(self, message:str, highlights:list=[] ,
|
132
|
+
def send_message(self, message:str, highlights:list=[] , file_list:list=[]):
|
133
133
|
"""
|
134
134
|
Envia uma mensagem para o canal do Slack.
|
135
135
|
Parâmetros:
|
@@ -151,7 +151,7 @@ class Slack():
|
|
151
151
|
|
152
152
|
try:
|
153
153
|
|
154
|
-
SendSlackMessageParamsValidator(message=message, highlights=highlights,
|
154
|
+
SendSlackMessageParamsValidator(message=message, highlights=highlights, file_list=file_list)
|
155
155
|
|
156
156
|
except ValidationError as e:
|
157
157
|
|
@@ -177,25 +177,25 @@ class Slack():
|
|
177
177
|
attachments=highlights
|
178
178
|
)
|
179
179
|
|
180
|
-
if
|
180
|
+
if file_list is not None and len(file_list) > 0:
|
181
181
|
|
182
182
|
# validar os arquivos anexados
|
183
183
|
|
184
|
-
for
|
184
|
+
for file_item in file_list:
|
185
185
|
|
186
|
-
if 'title' in
|
186
|
+
if 'title' in file_item and 'file' in file_item:
|
187
187
|
|
188
|
-
if
|
188
|
+
if file_item['title'] is not None and len(str(file_item['title']).replace(" ","")) > 0 and file_item['file'] is not None and len(str(file_item['file']).replace(" ","")) > 0:
|
189
189
|
|
190
|
-
success_attachments.append(
|
190
|
+
success_attachments.append(file_item)
|
191
191
|
|
192
192
|
else:
|
193
193
|
|
194
|
-
failed_attachments.append(
|
194
|
+
failed_attachments.append(file_item)
|
195
195
|
|
196
196
|
else:
|
197
197
|
|
198
|
-
failed_attachments.append(
|
198
|
+
failed_attachments.append(file_item)
|
199
199
|
|
200
200
|
if len(success_attachments) > 0:
|
201
201
|
|
@@ -5,11 +5,11 @@ 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=
|
8
|
+
csc_cia_stne/logger_json.py,sha256=UhpRWh9ij7VibxNm1fcTmisRJ_A1RsHE8_FVIWo74Lc,3179
|
9
|
+
csc_cia_stne/logger_rich.py,sha256=F3qG5bhrS1GJ3tH8AO0cfvHwzzJPLtcH0eyPbh0dnLg,7862
|
10
10
|
csc_cia_stne/provio.py,sha256=yTRX4YJ6RdNc2ZCVPgsIEgsxe3wQgwnXns4bPX4plAI,3955
|
11
11
|
csc_cia_stne/servicenow.py,sha256=3eifPWOIGv2udGpI3cr2SkMMKcQR4xHlA_fiOdw_fmg,32136
|
12
|
-
csc_cia_stne/slack.py,sha256=
|
12
|
+
csc_cia_stne/slack.py,sha256=33_UNF7M529eIuWjmzSJFEZ4RmVNkFkuVxvxwsKY1tQ,8126
|
13
13
|
csc_cia_stne/stne_admin.py,sha256=vnGSEzcmqWE42vg71oEuoRg6ENaGsZsXFOjxduSH4KU,23561
|
14
14
|
csc_cia_stne/utilitarios/__init__.py,sha256=oWxCOFL2wxjs8KBgxoeA6-gVe4ulicVGDgdaw8jzvsY,253
|
15
15
|
csc_cia_stne/utilitarios/functions/__init__.py,sha256=iSLKxM8lgPM1lJ51WZ1mwy36IW5iitfMRc_AnEtzpxg,364
|
@@ -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.42.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
|
26
|
+
csc_cia_stne-0.0.42.dist-info/METADATA,sha256=AB0qLp7WzeVcI29wzgRVzFrSdu9N_LQq7hr6mTGkYZQ,1121
|
27
|
+
csc_cia_stne-0.0.42.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
28
|
+
csc_cia_stne-0.0.42.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
|
29
|
+
csc_cia_stne-0.0.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|