AAAA
This commit is contained in:
parent
cec1fca7d4
commit
f24f6d9735
Binary file not shown.
13
crush.py
13
crush.py
@ -9,6 +9,8 @@
|
||||
|
||||
import vevoxqa
|
||||
from tqdm import tqdm
|
||||
from random import randint
|
||||
import time
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
@ -33,12 +35,18 @@ def main():
|
||||
vq.close()
|
||||
|
||||
elif cmdparts[0] == "upvote":
|
||||
with tqdm(total=int(cmdparts[2]), bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') as pbar:
|
||||
with ThreadPoolExecutor(max_workers=int(cmdparts[3])) as ex:
|
||||
if len(cmdparts) < 4:
|
||||
workers = 8
|
||||
else:
|
||||
workers = int(cmdparts[3])
|
||||
|
||||
with tqdm(total=int(cmdparts[2]), bar_format='{l_bar}{bar:20}{r_bar}{bar:-20b}') as pbar:
|
||||
with ThreadPoolExecutor(max_workers=workers) as ex:
|
||||
futures = [ex.submit(upvote, sessionid, cmdparts[1]) for i in range(int(cmdparts[2]))]
|
||||
for future in as_completed(futures):
|
||||
pbar.update(1)
|
||||
|
||||
|
||||
elif cmdparts[0] == "questions":
|
||||
vq = vevoxqa.VevoxQA(sessionid)
|
||||
vq.connect()
|
||||
@ -56,6 +64,7 @@ def upvote(sessionid, questionid):
|
||||
liker.connect()
|
||||
count = liker.likequestion(questionid)
|
||||
liker.close()
|
||||
return count
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
tqdm
|
||||
requests
|
||||
websocket-client
|
||||
Loading…
x
Reference in New Issue
Block a user