1
0

Improved caching

This commit is contained in:
Jon Michael Aanes 2024-10-10 14:00:47 +02:00
parent 809956059b
commit e594dff149

View File

@ -115,9 +115,7 @@ class FavroClient:
next(self.get_todo_list_cards())
def get_todo_list_cards(self) -> Iterator[Card]:
for card in self.get_cards(todo_list=True):
self.card_cache.add_card(card)
yield card
yield from self.get_cards(todo_list=True)
def get_cards(
self,
@ -127,7 +125,9 @@ class FavroClient:
todo_list=False,
) -> Iterator[Card]:
request = self._get_cards_request(seq_id=seq_id,todo_list=todo_list,collection_id=collection_id)
yield from self._get_paginated(request, Card.from_json)
for card in self._get_paginated(request, Card.from_json):
self.card_cache.add_card(card)
yield card
def get_collections(self) -> Iterator[Collection]:
request = requests.Request('GET', URL_GET_COLLECTIONS)