Expand year url, prepare check.
This commit is contained in:
parent
cc34273c77
commit
d5c016e4d4
1 changed files with 16 additions and 5 deletions
21
fetch_fio.sh
21
fetch_fio.sh
|
@ -139,6 +139,15 @@ download_file() {
|
|||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Downloads single year
|
||||
# $1 - apikey
|
||||
# $2 - year
|
||||
# $3 - destination file name
|
||||
download_year() {
|
||||
echo "${APIURI}/periods/$1/$2-01-01/$2-12-31/transactions.csv"
|
||||
}
|
||||
|
||||
# Current year (last in seq)
|
||||
CYEAR=`date +%Y`
|
||||
|
||||
|
@ -171,13 +180,15 @@ while read accnt ; do
|
|||
continue
|
||||
fi
|
||||
|
||||
# Log action
|
||||
# Iterate over years
|
||||
for year in `seq $YEAR $CYEAR` ; do
|
||||
# Log action
|
||||
log "Processing account $ACCNO for $year"
|
||||
|
||||
# Fetch CSV from bank
|
||||
CSVNAME="$BANK_DIR/$ACCNO.csv"
|
||||
#download_file "${APIURI}/periods/${APIKEY}/2015-01-01/2025-01-31/transactions.csv" "$CSVNAME"
|
||||
|
||||
# Check whether it needs fetching
|
||||
CSVNAME="$BANK_DIR_PARTS/$ACCNO-$year.csv"
|
||||
echo "CSVNAME=$CSVNAME"
|
||||
download_year "$APIKEY" $year $CSVNAME
|
||||
done
|
||||
done < "$APIKEYS_FILE"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue