-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproxyChecker.py
30 lines (26 loc) · 915 Bytes
/
proxyChecker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import traceback
import argparse
from time import sleep
from typing import Optional
from src.func import get_relative_path
from proxy_hunter import truncate_file_content
from src.func_proxy import check_all_proxies
def run_proxy_checker(max_proxies: Optional[int] = None):
if not max_proxies:
max_proxies = 100
truncate_file_content(get_relative_path("proxyChecker.txt"))
try:
check_all_proxies(max_proxies)
except Exception as e:
print("fail checking all proxies", e)
traceback.print_exc()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Proxy Checker")
parser.add_argument("--max", type=int, help="Maximum number of proxies to check")
args = parser.parse_args()
if args.max:
max_proxies = args.max
else:
max_proxies = 100
run_proxy_checker(max_proxies)
sleep(3) # Wait 3 seconds before exit