Skip to content

Commit

Permalink
Added is-api.
Browse files Browse the repository at this point in the history
  • Loading branch information
DemonicSavage committed Nov 28, 2023
1 parent d4e1408 commit 52709ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mikan/html_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def get(self, url: str) -> ClientResponse:
return await self.session.get(url)

async def get_page(self, idx: int) -> list[None]:
data = await self.get(f"{self.card_type.list_url}{idx}") if self.card_type.card_dir != "SIF_Cards" else idx
data = await self.get(f"{self.card_type.list_url}{idx}") if not self.card_type.is_api else idx
page = await self.list_parser.get_page(data)

if self.card_type.card_dir not in self.objs:
Expand All @@ -53,7 +53,7 @@ async def get_items(self) -> None:
current_num = 1
for _ in range(1, num_pages):
current_page = await self.get_page(current_num)
if not current_page and self.card_type.card_dir != "SIF_Cards":
if not current_page and not self.card_type.is_api:
break

current_num += 1
Expand Down
1 change: 1 addition & 0 deletions src/mikan/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Plugin:
list_url = ""
cli_arg = ""
desc = ""
is_api = False

def __init_subclass__(cls) -> None:
super().__init_subclass__()
Expand Down
1 change: 1 addition & 0 deletions src/mikan/plugins/sif.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class SIF(Plugin):
list_url = "https://schoolido.lu/api/cardids/"
cli_arg = "sif"
desc = "SIF cards"
is_api = True

class ListParser:
def __init__(self) -> None:
Expand Down

0 comments on commit 52709ef

Please sign in to comment.