Sitemap generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
407 B

4 years ago
  1. import asyncio
  2. from aiofile import AIOFile, Reader, Writer
  3. import logging
  4. class TextWriter():
  5. def __init__(self, filename: str):
  6. self.filename = filename
  7. async def write(self, urls):
  8. async with AIOFile(self.filename, 'w') as aiodf:
  9. writer = Writer(aiodf)
  10. for url in urls:
  11. await writer("{}\n".format(url))
  12. await aiodf.fsync()