fedi-tools/delete_posts.py

23 lines
513 B
Python
Raw Normal View History

2023-01-10 22:56:01 -08:00
#!/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:
2023-01-10 22:56:01 -08:00
print('Deleting...')
async for status in fedi.account_statuses_iter(await fedi.me(), exclude_repeats=False):
2023-01-10 22:56:01 -08:00
if status['reblog']:
await fedi.un_repeat(status['reblog'])
2023-01-10 22:56:01 -08:00
else:
await fedi.delete_status(status)
2023-01-10 22:56:01 -08:00
print('.', end='', flush=True)
print()
if __name__ == '__main__':
import anyio
anyio.run(main)