diff --git a/install_jaymod.py b/install_jaymod.py index 698e6df..01fb135 100644 --- a/install_jaymod.py +++ b/install_jaymod.py @@ -5,9 +5,6 @@ import shutil import time import urllib3 -from threading import Thread -from urllib3 import PoolManager - FORMAT = "%(asctime)s - %(levelname)s - %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) @@ -29,9 +26,9 @@ FILES = ( ) -def get_files(http: PoolManager, filename: str, outdir: str): +def get_file(filename: str, outdir: str): with open(os.path.join(outdir, filename), "wb") as out: - r = http.request("GET", f"{URL}/{filename}", preload_content=False) + r = urllib3.request("GET", f"{URL}/{filename}", preload_content=False) shutil.copyfileobj(r, out) @@ -56,15 +53,7 @@ if __name__ == "__main__": logging.fatal(e) exit(1) - threads = [] - http = urllib3.PoolManager() - for f in FILES: - t = Thread(target=get_files, args=[http, f, jaymod_dir]) - threads.append(t) - t.start() - - for t in threads: - t.join() + get_file(f, jaymod_dir) logging.info(f"elapsed time: {time.perf_counter() - start:.2f}s")