From 541584274b9d2679e06b7b4c8dec639f8988141d Mon Sep 17 00:00:00 2001 From: Slawa Gurevich Date: Wed, 29 Jul 2026 13:05:17 +0200 Subject: [PATCH] Fixed NoneObject error caused by having empty lines in the header file --- llvd/process_io.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/llvd/process_io.py b/llvd/process_io.py index 4db84c1..8d8e20a 100644 --- a/llvd/process_io.py +++ b/llvd/process_io.py @@ -19,16 +19,22 @@ def parse_cookie_file(): click.style(f"cookies.txt not found or is empty", fg="red")) sys.exit(0) -def parse_header_file(path = "headers.txt"): +def parse_header_file(path="headers.txt"): headers = {} + try: - with open(path, "r", encoding="utf8") as cookies_file: - lines = cookies_file.readlines() - for line in lines: - parts = line.split("=",1) - key, value = parts + [None]*(2-len(parts)) - headers[key] = value.replace("\"", "").strip() + with open(path, "r", encoding="utf8") as file: + for line in file: + line = line.strip() + + if not line: + continue + + key, value = line.split("=", 1) + headers[key] = value.replace('"', "") + return headers + except FileNotFoundError: click.echo( click.style(f"{path} not found or is empty", fg="red"))