Config for todo

This commit is contained in:
bel
2020-04-02 23:12:32 +00:00
parent eead63ecb6
commit dac2114af0
3 changed files with 110 additions and 3 deletions

22
main.go
View File

@@ -3,6 +3,7 @@ package main
import (
"local/sandbox/contact/contact"
"log"
"time"
)
func main() {
@@ -13,11 +14,30 @@ func main() {
Password: config.EmailPass,
}
log.Println(emailer)
//{45b6895c6dd6345f46e6e15dd2c61f03 Chase 12.86 GOOGLE *GSUITE_blapo [Wed, 1 Apr 2020 10:14:11 -0400 (EDT)]}
log.Println(Upload(config, NewTransaction("11.11", "vendor", time.Now().String(), Bank(0))))
return
emails, err := emailer.Read()
if err != nil {
panic(err)
}
for _, email := range emails {
log.Println(Scrape(email))
transactions, err := Scrape(email)
if err != nil {
log.Println("failed to scrape email:", err)
}
for _, transaction := range transactions {
if _, err := config.Storage.Get(transaction.ID); err == nil {
log.Println("skipping duplicate transaction:", transaction)
} else {
if err := Upload(config, transaction); err != nil {
log.Println("failed to upload transaction", transaction, ":", err)
} else if err := config.Storage.Set(transaction.ID, []byte(transaction.String())); err != nil {
log.Println("failed to log", transaction, ":", err)
}
}
}
}
}