add --simulate arg to freakpos.py
This commit is contained in:
parent
e9c6d23627
commit
4fdca63bb7
10
freakpos.py
10
freakpos.py
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import anyio
|
||||
import qtoml
|
||||
import random
|
||||
|
@ -27,9 +28,16 @@ def gen_post(messages, labels):
|
|||
async def main():
|
||||
config = load_config()
|
||||
static_data = load_static()
|
||||
post = gen_post(*static_data)
|
||||
|
||||
print(post)
|
||||
|
||||
if '--simulate' in sys.argv[1:]:
|
||||
return
|
||||
|
||||
async with pleroma.Pleroma(api_base_url=config['site'], access_token=config['access_token']) as pl:
|
||||
visibility = 'direct' if config.get('test_mode', False) else 'unlisted'
|
||||
await pl.post(gen_post(*static_data), visibility=visibility)
|
||||
await pl.post(post, visibility=visibility)
|
||||
|
||||
if __name__ == '__main__':
|
||||
anyio.run(main)
|
||||
|
|
Loading…
Reference in New Issue