From e53e7106e70f8a52e37338bff79f5c3d41d37071 Mon Sep 17 00:00:00 2001 From: Michael Davydov Date: Fri, 13 Jan 2023 11:50:04 +0300 Subject: [PATCH] yaml safe load --- app.py | 2 +- asana_api.py | 2 +- icalendar_parser.py | 2 +- restore_from_backup_file.py | 2 +- todoist_api.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index da01f9a..deed326 100644 --- a/app.py +++ b/app.py @@ -33,7 +33,7 @@ # Read config with open(os.path.join(appdir, 'config.yaml'), 'r') as f: - config = yaml.load(f.read()) + config = yaml.safe_load(f.read()) # Fetch todoist items todoist_api = TodoistAPI(config['todoist_token']) diff --git a/asana_api.py b/asana_api.py index 63c6b2d..1b7b0b5 100644 --- a/asana_api.py +++ b/asana_api.py @@ -78,7 +78,7 @@ def get_user_id_by_name(self, user_name): if __name__ == "__main__": # Testing with open(os.path.join(appdir, 'config.yaml'), 'r') as f: - config = yaml.load(f.read()) + config = yaml.safe_load(f.read()) print(AsanaAPI(config['asana'][0]['personal_access_token']).get_workspaces()) # for task in AsanaAPI(config['asana'][0]['personal_access_token']).get_tasks(config['asana'][0]['task_params']): diff --git a/icalendar_parser.py b/icalendar_parser.py index f202eb9..e596c80 100644 --- a/icalendar_parser.py +++ b/icalendar_parser.py @@ -12,7 +12,7 @@ appdir = os.path.dirname(os.path.realpath(__file__)) # rp, realpath with open(os.path.join(appdir, 'config.yaml'), 'r') as f: - config = yaml.load(f.read()) + config = yaml.safe_load(f.read()) local = pytz.timezone(config['local_timezone']) diff --git a/restore_from_backup_file.py b/restore_from_backup_file.py index 9c05431..f5a3683 100644 --- a/restore_from_backup_file.py +++ b/restore_from_backup_file.py @@ -13,7 +13,7 @@ appdir = os.path.dirname(os.path.realpath(__file__)) with open(os.path.join(appdir, 'config.yaml'), 'r') as f: - config = yaml.load(f.read()) + config = yaml.safe_load(f.read()) api = TodoistAPI(config['todoist_token']) diff --git a/todoist_api.py b/todoist_api.py index e1d0859..f1b05f8 100644 --- a/todoist_api.py +++ b/todoist_api.py @@ -100,5 +100,5 @@ def add_item(self, item_data): if __name__ == "__main__": # Testing with open(os.path.join(appdir, 'config.yaml'), 'r') as f: - config = yaml.load(f.read()) + config = yaml.safe_load(f.read()) print(TodoistAPI(config['todoist_token']).get_items("projects"))