Changeset - aea800cedcbd
[Not reviewed]
0 2 0
x - 11 months ago 2024-05-09 21:08:54
xbr@c3l.lu
fix: clean up console logging
2 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
backend/generic_handler.py
Show inline comments
 
@@ -46,8 +46,8 @@ class Verificator:
 
            elif e.verify_code == ROOT_NOT_TRUSTED:
 
                return TLSDetails(domain_name=domain, error_message="invalid: root not trusted.")
 
            else:
 
                return TLSDetails(domain_name=domain, error_message="failed verification: " + e.verify_message + ".")
 
                return TLSDetails(domain_name=domain, error_message="failed verification: " + e.verify_message)
 
        except ssl.SSLError as e:
 
            return TLSDetails(domain_name=domain, error_message="could not establish a secure connection: " + e.reason + ".")
 
            return TLSDetails(domain_name=domain, error_message="could not establish a secure connection: " + e.reason)
 
        except Exception as e:
 
            return TLSDetails(domain_name=domain, error_message="could not connect: " + str(e) + ".")
 
\ No newline at end of file
 
            return TLSDetails(domain_name=domain, error_message="could not connect: " + str(e))
 
\ No newline at end of file
backend/tls_utils.py
Show inline comments
 
@@ -22,13 +22,13 @@ class TLSDetails:
 

	
 
    def print(self, console: Console):
 
        if self.connection_error:
 
            console.log("[orange bold underline]" + self.domain_name, self.error_message, style="orange")
 
            console.log("[bold underline]" + self.domain_name, self.error_message, style="orange")
 
        elif self.error_message != None:
 
            console.log("[red bold underline]" + self.domain_name, self.error_message, style="red")
 
            console.log("[bold underline]" + self.domain_name, self.error_message, style="red")
 
        elif self.expires_in_days < 0:
 
            console.log("[red bold underline]" + self.domain_name, "expired", abs(self.expires_in_days), "days ago.", style="red")
 
            console.log("[bold underline]" + self.domain_name, "expired", abs(self.expires_in_days), "days ago.", style="red")
 
        else:
 
            console.log("[green bold underline]" + self.domain_name, "expires in", self.expires_in_days, "days", style="green")
 
            console.log("[bold underline]" + self.domain_name, "expires in", self.expires_in_days, "days", style="green")
 

	
 
def compare_expiry_timestamps(expiry_timestamp: int, now_timestamp: int = datetime.datetime.now(datetime.UTC).timestamp()) -> tuple[bool, int]:
 
    seconds_left = expiry_timestamp - now_timestamp
0 comments (0 inline, 0 general)