From b53fa8cfec33bdb9eedffdc76341fa18821a4a25 Mon Sep 17 00:00:00 2001 From: a-eloCard <esrsc23@inf.ufpr.br> Date: Mon, 30 Sep 2024 10:12:05 -0300 Subject: [PATCH] UPDATE Changing status name to state --- app/parser.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/parser.py b/app/parser.py index f4aea52..11e35e0 100644 --- a/app/parser.py +++ b/app/parser.py @@ -18,7 +18,7 @@ DIR_O_C3SL = os.path.join(os.getcwd(), '../../cms-c3sl/themes/c3sl/exampleSite/c DIR_POSTS = os.path.join(os.getcwd(), '../../cms-c3sl/themes/c3sl/exampleSite/content/noticia') DIR_PROJECTS = os.path.join(os.getcwd(), '../../cms-c3sl/themes/c3sl/exampleSite/content/projetos') -def create_or_update_noticia(identifier, data, event, content_type): +def create_or_update(identifier, data, event, content_type): if not data: logging.error(f"Code: 400" f"Status: JSON file not found\n") @@ -46,7 +46,7 @@ layout: 'legal' #Coleta os dados necessários para estar no arquivo JSON attributes = data.get('entry', {}) title = attributes.get('Titulo', '') - status = attributes.get('Status', '') + status = attributes.get('Estado', '') partner = attributes.get('Parceiro', '') content = attributes.get('Descricao', '') @@ -120,7 +120,7 @@ summary: "{summary}" return f"Error writing file{e}", 400 #Deleta algum tipo de conteudo enviado por requisição -def delete_noticia(identifier, content_type): +def delete(identifier, content_type): #Deletando uma notícia if content_type == 'noticia': file_name = f"{identifier}.md" @@ -175,14 +175,14 @@ def run_script(): return f"File created in Strapi {identifier} - Type: {content_type}", 200 elif event in ['entry.update', 'entry.publish']: - create_or_update_noticia(identifier, data, event, content_type) + create_or_update(identifier, data, event, content_type) logging.info(f"\nFile created in Hugo- ID: {identifier} - Type: {content_type}" f"\nData: {data}\nOperation completed successfully\n") return f"Operation completed successfully\n Data: {data}", 200 elif event in ['entry.delete', 'entry.unpublish']: - delete_noticia(identifier, content_type) + delete(identifier, content_type) logging.info(f"File removed - ID: {identifier} - Type: {content_type}") return f"File removed with ID {identifier}", 200 -- GitLab