added loop functionality

This commit is contained in:
Wardyn 2023-01-23 16:34:45 -08:00
parent 91cd12c2b4
commit b8d23ee58e
1 changed files with 29 additions and 8 deletions

View File

@ -6,6 +6,19 @@ import json
from getpass import getpass from getpass import getpass
import os import os
from urllib.parse import urlencode from urllib.parse import urlencode
import argparse
import time
parser = argparse.ArgumentParser()
parser.add_argument('-l', '--loop',
action='store',
type=float,
help='Loop command every x hours',
default=None,
dest='loop'
)
args = parser.parse_args()
loop = args.loop
#Ensure Credentials #Ensure Credentials
parent = os.path.dirname(os.path.realpath(__file__)) parent = os.path.dirname(os.path.realpath(__file__))
@ -61,15 +74,23 @@ with open('adjectives.txt') as f:
with open('verbs.txt') as f: with open('verbs.txt') as f:
verbs = list(map(str.rstrip, f)) verbs = list(map(str.rstrip, f))
postform = random.choice((
formats = (
'{adjective} {gender} who {verb}', '{adjective} {gender} who {verb}',
'{adjective} {gender}', '{adjective} {gender}',
'{gender} who {verb}', '{gender} who {verb}',
)) )
genders = ('lgf', 'lbf', 'elf')
gender = random.choice(('lgf', 'lbf', 'elf')) while True:
verb = random.choice(verbs) postform = random.choice(formats)
adjective = random.choice(adjectives) gender = random.choice(genders)
content = postform.format(adjective=adjective, gender=gender, verb=verb) verb = random.choice(verbs)
print(content) adjective = random.choice(adjectives)
session.post(instance + '/api/v1/statuses', data={'status':content, 'visibility':'unlisted'}) content = postform.format(adjective=adjective, gender=gender, verb=verb)
print(content)
session.post(instance + '/api/v1/statuses', data={'status':content, 'visibility':'unlisted'})
if loop:
time.sleep(loop * 3600)
else:
break