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: