예제 #1
0
 def stmtEndRq(self):
     return StmtEndRq(
         acctid="111111",
         accttype="CHECKING",
         dtstart=datetime(2017, 1, 1, tzinfo=UTC),
         dtend=datetime(2017, 3, 31, tzinfo=UTC),
     )
예제 #2
0
def request_stmtend(args: ArgsType) -> None:
    """
    Send *STMTENDRQ
    """
    dt = convert_datetime(args)
    password = get_passwd(args)

    if args["all"]:
        acctinfo = _request_acctinfo(args, password)
        _merge_acctinfo(args, acctinfo)

    stmtendrqs: List[Union[StmtEndRq, CcStmtEndRq]] = []
    for accttype in ("checking", "savings", "moneymrkt", "creditline"):
        acctids = args[accttype]
        stmtendrqs.extend(
            [
                StmtEndRq(
                    acctid=acctid,
                    accttype=accttype.upper(),
                    dtstart=dt["start"],
                    dtend=dt["end"],
                )
                for acctid in acctids
            ]
        )

    for acctid in args["creditcard"]:
        stmtendrqs.append(
            CcStmtEndRq(acctid=acctid, dtstart=dt["start"], dtend=dt["end"])
        )

    if not stmtendrqs:
        accttypes = ["checking", "savings", "moneymrkt", "creditline", "creditcard"]
        msg = f"No accounts specified; configure at least one of {accttypes}"
        warnings.warn(msg, category=SyntaxWarning)

    client = init_client(args)
    with client.request_statements(
        password,
        *stmtendrqs,
        dryrun=args["dryrun"],
        gen_newfileuid=not args["nonewfileuid"],
    ) as f:
        response = f.read()

    print(response.decode())

    if args["write"]:
        write_config(args)

    if args["savepass"]:
        save_passwd(args, password)