From ce10f4133052d43e6930babd8bf79c4ff2baa628 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 1 Oct 2024 13:23:22 +0200 Subject: [PATCH] More robust UserInfo --- favro_sync/__main__.py | 2 +- favro_sync/favro_data_model.py | 8 ++++---- favro_sync/favro_fuse.py | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/favro_sync/__main__.py b/favro_sync/__main__.py index 11ee231..e500928 100644 --- a/favro_sync/__main__.py +++ b/favro_sync/__main__.py @@ -16,7 +16,7 @@ def main(): with tempfile.TemporaryDirectory(prefix='favro_sync_') as tmpdirname: session = requests_cache.CachedSession( tmpdirname + '/http-cache.sqlite', - expire_after=10, + expire_after=300, ) client = FavroClient( diff --git a/favro_sync/favro_data_model.py b/favro_sync/favro_data_model.py index cb6468a..989aa1a 100644 --- a/favro_sync/favro_data_model.py +++ b/favro_sync/favro_data_model.py @@ -57,10 +57,10 @@ class UserInfo: @staticmethod def from_json(json: dict[str, Any]) -> 'UserInfo': return UserInfo( - UserId(json['userId']), - json['name'], - json['email'], - json['organizationRole'], + map_opt(UserId, json.get('userId')), + json.get('name'), + json.get('email'), + json.get('organizationRole'), ) diff --git a/favro_sync/favro_fuse.py b/favro_sync/favro_fuse.py index 9288f9e..5ed893d 100644 --- a/favro_sync/favro_fuse.py +++ b/favro_sync/favro_fuse.py @@ -201,6 +201,7 @@ class FavroFuse(fuse.Fuse): seq_id=card.seq_id.raw_id, ), todo_list_completed = card.todo_list_completed, + archived=card.archived, start_date= card.start_date, due_date= card.due_date, )