fix wallabag_explorer.py and add page param
This commit is contained in:
2
uv.lock
generated
2
uv.lock
generated
@@ -953,7 +953,7 @@ wheels = [
|
||||
[[package]]
|
||||
name = "wallabag-api"
|
||||
version = "1.2.3"
|
||||
source = { git = "https://git.gasser.ovh/thib8956/wallabag-api-client.git#275cf0c6b0f73347bb177eac097e47cd0014ac21" }
|
||||
source = { git = "https://git.gasser.ovh/thib8956/wallabag-api-client.git#4ef3de646ef303ec5eb3f9f05da75cb919683f3d" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
]
|
||||
|
||||
@@ -9,21 +9,21 @@ 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 async_main(path: str = "config.ini", per_page: int = 10):
|
||||
async def async_main(path: str = "config.ini", page: int = 1, per_page: int = 10):
|
||||
async with aiohttp.ClientSession() 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)
|
||||
print(entries)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--config", default="config.ini", help="Path to config file")
|
||||
parser.add_argument("--page", type=int, default=1, help="Page number")
|
||||
parser.add_argument("--per-page", type=int, default=10, help="Entries per page")
|
||||
args = parser.parse_args()
|
||||
asyncio.run(async_main(args.config, args.per_page))
|
||||
asyncio.run(async_main(args.config, args.page, args.per_page))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user