diff --git a/src/rofi_rbw/credentials.py b/src/rofi_rbw/credentials.py index bf25b29..ee3615e 100644 --- a/src/rofi_rbw/credentials.py +++ b/src/rofi_rbw/credentials.py @@ -7,14 +7,17 @@ def __init__(self, data: str) -> None: self.totp = "" # Parse rbw output - self.password, *rest = data.split('\n') + self.password, *rest = data.strip().split('\n') for line in rest: - key, value = line.rsplit(": ", 1) - if key == "Username": - self.username = value - elif key == "TOTP Secret": - try: - import pyotp - self.totp = pyotp.parse_uri(value).now() - except ModuleNotFoundError: - pass + try: + key, value = line.split(": ", 1) + if key == "Username": + self.username = value + elif key == "TOTP Secret": + try: + import pyotp + self.totp = pyotp.parse_uri(value).now() + except ModuleNotFoundError: + pass + except ValueError: + pass diff --git a/src/rofi_rbw/rofi_rbw.py b/src/rofi_rbw/rofi_rbw.py index 73f2108..1418612 100755 --- a/src/rofi_rbw/rofi_rbw.py +++ b/src/rofi_rbw/rofi_rbw.py @@ -22,7 +22,7 @@ from credentials import Credentials from paths import * -__version__ = '0.4.0' +__version__ = '0.4.1' class RofiRbw(object): diff --git a/src/rofi_rbw/selector.py b/src/rofi_rbw/selector.py index 9684497..9e317ef 100644 --- a/src/rofi_rbw/selector.py +++ b/src/rofi_rbw/selector.py @@ -1,8 +1,11 @@ -from rofi_rbw.abstractionhelper import is_wayland, is_installed - from typing import List, Tuple from subprocess import run +try: + from rofi_rbw.abstractionhelper import is_wayland, is_installed +except: + from abstractionhelper import is_wayland, is_installed + class Selector: @staticmethod