This commit is contained in:
@@ -7,11 +7,14 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gogs.inhome.blapointe.com/ana-ledger/src/bank"
|
||||
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
@@ -55,7 +58,14 @@ func (c Client) Transactions(ctx context.Context, a bank.Account) ([]bank.Transa
|
||||
return result, err
|
||||
}
|
||||
|
||||
var limiter = rate.NewLimiter(0.1, 1)
|
||||
|
||||
func (c Client) get(ctx context.Context, url, token string, ptr interface{}) error {
|
||||
if err := limiter.Wait(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("Teller.Get(%s, %s)", url, token)
|
||||
httpc := &http.Client{
|
||||
Timeout: time.Second,
|
||||
Transport: &http.Transport{
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
token_2utqstwpn3pxwgvyno56hqdehq
|
||||
token_vr6dnzvfv7c24wuxtmnnzyiqbm
|
||||
token_r4pbocuwhxoorjiag67rq4zen4
|
||||
|
||||
@@ -13,7 +13,7 @@ type Account struct {
|
||||
} `json:"institution"`
|
||||
Name string `json:"last_four"`
|
||||
Account string `json:"id"`
|
||||
Token string `json:"-"`
|
||||
Token string `json:"__token"`
|
||||
}
|
||||
|
||||
type Transaction struct {
|
||||
|
||||
Reference in New Issue
Block a user