csc-cia-stne 0.0.57__py3-none-any.whl → 0.0.59__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/google_drive.py +28 -7
- {csc_cia_stne-0.0.57.dist-info → csc_cia_stne-0.0.59.dist-info}/METADATA +1 -1
- {csc_cia_stne-0.0.57.dist-info → csc_cia_stne-0.0.59.dist-info}/RECORD +6 -6
- {csc_cia_stne-0.0.57.dist-info → csc_cia_stne-0.0.59.dist-info}/LICENCE +0 -0
- {csc_cia_stne-0.0.57.dist-info → csc_cia_stne-0.0.59.dist-info}/WHEEL +0 -0
- {csc_cia_stne-0.0.57.dist-info → csc_cia_stne-0.0.59.dist-info}/top_level.txt +0 -0
csc_cia_stne/google_drive.py
CHANGED
@@ -227,7 +227,7 @@ class GoogleDrive():
|
|
227
227
|
logging.error(f"Ocorreu um erro ao fazer a requisição. Error: {e}")
|
228
228
|
|
229
229
|
|
230
|
-
def
|
230
|
+
def download_file(self, file : str, mimeType : str):
|
231
231
|
"""
|
232
232
|
Obtém o conteúdo de um arquivo armazenado no Google Drive.
|
233
233
|
|
@@ -253,16 +253,37 @@ class GoogleDrive():
|
|
253
253
|
- A função assume a existência de um atributo `self.service` configurado para interagir com a API do Google Drive.
|
254
254
|
"""
|
255
255
|
try:
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
return {"success" : True, "result" : file_data}
|
256
|
+
request = self.service.files().export_media(fileId=file.get("id"), mimeType=mimeType)
|
257
|
+
with open (file["name"], "wb") as f:
|
258
|
+
f.write(request.execute())
|
259
|
+
return {"success" : True, "result" : f"Arquivo baixado com sucesso. Diretório: {file}"}
|
262
260
|
|
263
261
|
except Exception as e:
|
264
262
|
logging.debug(f"Erro ao tentar abrir o arquivo. Erro {e}")
|
265
263
|
return {"success" : False, "result" : None}
|
264
|
+
|
266
265
|
|
266
|
+
def get_base_data(self, id_sheet:str,page:str) -> list:
|
267
|
+
"""
|
268
|
+
Retorna os dados da planilha especificada.
|
269
|
+
Parâmetros:
|
270
|
+
- drive_client: Cliente do Google Drive.
|
271
|
+
- id_sheet: ID da planilha.
|
272
|
+
- page: Nome da página da planilha.
|
273
|
+
Retorna:
|
274
|
+
- Uma lista contendo os valores da planilha.
|
275
|
+
Exemplo de uso:
|
276
|
+
>>> drive_client = ...
|
277
|
+
>>> id_sheet = "abc123"
|
278
|
+
>>> page = "Sheet1"
|
279
|
+
>>> data = get_base_data(drive_client, id_sheet, page)
|
280
|
+
"""
|
281
|
+
try:
|
282
|
+
sheet = self.service.spreadsheets()
|
283
|
+
result = sheet.values().get(spreadsheetId=id_sheet, range=page).execute()
|
284
|
+
values = result.get('values', [])
|
285
|
+
return {"success" : True, "result" : values}
|
286
|
+
except Exception as e:
|
287
|
+
return {"success" : False, "result" : None, "error" : str(e)}
|
267
288
|
|
268
289
|
|
@@ -3,7 +3,7 @@ csc_cia_stne/bc_correios.py,sha256=pQAnRrcXEMrx3N1MWydZVIhEQLerh3x8-0B045zZIzk,2
|
|
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
|
-
csc_cia_stne/google_drive.py,sha256=
|
6
|
+
csc_cia_stne/google_drive.py,sha256=lgcOd27vk2Mb_wP_fAWIbec-S3MIBKyh4TpRth6REXc,12788
|
7
7
|
csc_cia_stne/karavela.py,sha256=jJCYX43D49gGuzmwwK6bN9XVnv2dXdp9iHnnV5H1LMQ,4794
|
8
8
|
csc_cia_stne/logger_json.py,sha256=CXxSCOFGMymDi8XE9SKnPKjW4D0wJLqDLnxqePS26i8,3187
|
9
9
|
csc_cia_stne/logger_rich.py,sha256=WlMqxH1lMy-tzK0I4NpBRgSzPdHc2-YSU71N3SsKM5A,8338
|
@@ -25,8 +25,8 @@ csc_cia_stne/utilitarios/validations/GoogleDriveValidator.py,sha256=PBo-AV2bjR__
|
|
25
25
|
csc_cia_stne/utilitarios/validations/ServiceNowValidator.py,sha256=yleKUIo1ZfyloP9fDPNjv3JJXdLcocT81WIgRSYmqEA,14423
|
26
26
|
csc_cia_stne/utilitarios/validations/__init__.py,sha256=O_qyEU2ji3u6LHUXZCXvUFsMpoMWL625qqHTXyXivTA,106
|
27
27
|
csc_cia_stne/utilitarios/validations/web_validator.py,sha256=HYKYSpDv1RvRjZIuwTPt-AbEz-9392MxM_O329iYuSA,5722
|
28
|
-
csc_cia_stne-0.0.
|
29
|
-
csc_cia_stne-0.0.
|
30
|
-
csc_cia_stne-0.0.
|
31
|
-
csc_cia_stne-0.0.
|
32
|
-
csc_cia_stne-0.0.
|
28
|
+
csc_cia_stne-0.0.59.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
|
29
|
+
csc_cia_stne-0.0.59.dist-info/METADATA,sha256=3vFFjntppBcEf6EHTT0_ZtYL8fdblJ6DZOVwZF0byoY,1265
|
30
|
+
csc_cia_stne-0.0.59.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
31
|
+
csc_cia_stne-0.0.59.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
|
32
|
+
csc_cia_stne-0.0.59.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|