fedi-tools/delete_posts.py

23 lines
513 B
Python
Executable File

#!/usr/bin/env python
from pleroma import Pleroma
async def main():
import os, sys
async with Pleroma(access_token=os.environ['ACCESS_TOKEN'], api_base_url=sys.argv[1]) as fedi:
print('Deleting...')
async for status in fedi.account_statuses_iter(await fedi.me(), exclude_repeats=False):
if status['reblog']:
await fedi.un_repeat(status['reblog'])
else:
await fedi.delete_status(status)
print('.', end='', flush=True)
print()
if __name__ == '__main__':
import anyio
anyio.run(main)