]> git.rmz.io Git - dotfiles.git/commitdiff
bin/monzo.py: skip declined transactions
authorSamir Benmendil <me@rmz.io>
Sun, 5 Sep 2021 22:48:47 +0000 (23:48 +0100)
committerSamir Benmendil <me@rmz.io>
Sun, 5 Sep 2021 22:48:47 +0000 (23:48 +0100)
bin/monzo.py

index 9f404ef0b50c33eccd7a9cf1a2e58a02e0f4b8e7..e54aae5bce487a124b76309cfcf1a471ca405d14 100755 (executable)
@@ -17,6 +17,9 @@ if __name__ == "__main__":
     with open(sys.argv[1], 'r') if len(sys.argv) > 1 else sys.stdin as fp:
         data = json.load(fp)
         for t in data.get("transactions"):
+            if t.get("decline_reason", ""):
+                continue
+
             try:
                 date = datetime.strptime(t["created"], "%Y-%m-%dT%H:%M:%S.%fZ")
             except ValueError: