radn-dev/commits/commits.py
2023-06-30 23:20:52 +00:00

27 lines
670 B
Python

import asyncio
import json
import aiohttp
async def main():
pages = []
async with aiohttp.ClientSession() as session:
i = 1
while True:
async with session.get(
f"https://gitea.parrrate.ru/api/v1/repos/PTV/radn-rs/commits?stat=true&page={i}",
headers={"accept": "application/json"},
) as response:
page = await response.json()
if not page:
break
pages.extend(page)
print(i)
i += 1
with open("commits.json", "w") as file:
json.dump(pages, file, indent=2)
asyncio.run(main())