From 592a36c6be3c65be8a96fe4505f4542f091c8ddc Mon Sep 17 00:00:00 2001 From: "Magne F. Myhren" Date: Tue, 21 Nov 2023 15:59:37 +0100 Subject: [PATCH] Passordsjekk i try-except --- Droplister/Droplister_v2.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Droplister/Droplister_v2.py b/Droplister/Droplister_v2.py index 05305e2..956de95 100644 --- a/Droplister/Droplister_v2.py +++ b/Droplister/Droplister_v2.py @@ -109,15 +109,16 @@ # ## Tilgang oracle username = getpass.getuser() -password = getpass.getpass(prompt='Oracle-passord: ') dsn = "DB1P" - -# + -engine = create_engine(f"oracle+cx_oracle://{username}:{password}@{dsn}") +try: + engine = create_engine(f"oracle+cx_oracle://{username}:{password}@{dsn}") +except: + print("Passord ikke skrevet inn") + password = getpass.getpass(prompt='Oracle-passord: ') + engine = create_engine(f"oracle+cx_oracle://{username}:{password}@{dsn}") # Opprett en tilkobling fra motoren conn = engine.connect() -# - # # Henter data