wallabag-tools/wallabag_explorer.py

21 lines
710 B
Python
Raw Normal View History

2023-12-21 14:22:35 +00:00
import asyncio
import aiohttp
from wallabag_api.wallabag import Wallabag
from helpers import load_configuration, connect_to_wallabag
async def get_paginated_entries(w_api: Wallabag, per_page: int, page: int):
return await w_api.get_entries(perPage=per_page, page=page)
async def main(path: str, per_page=10):
async with aiohttp.ClientSession(loop=asyncio.get_event_loop()) as session:
configuration = dict(load_configuration(path))
w_api = await connect_to_wallabag(configuration, session)
for page in range(1, 10):
entries = await get_paginated_entries(w_api, per_page, page)
if __name__ == "__main__":
asyncio.run(main("config.ini"), debug=True)