working but should scroll emails

This commit is contained in:
bel
2020-04-02 23:23:53 +00:00
parent dac2114af0
commit c4cf4dfbd6
3 changed files with 14 additions and 15 deletions

View File

@@ -1,20 +1,19 @@
package main
import (
"errors"
"fmt"
"io/ioutil"
"local/oauth2"
"log"
"net/http"
"net/url"
"strings"
"time"
)
func Upload(config Config, transaction *Transaction) error {
params := url.Values{
"list": {"2548023766"},
"title": {"test task: " + time.Now().String()},
"tag": {"expense"},
"list": {config.TodoList},
"title": {fmt.Sprintf("%v: %s @ %s @ %s", transaction.Bank, transaction.Amount, transaction.Account, transaction.Date)},
"tag": {config.TodoTag},
}
req, err := http.NewRequest("POST", config.TodoAddr+"/ajax.php?newTask", strings.NewReader(params.Encode()))
if err != nil {
@@ -26,6 +25,10 @@ func Upload(config Config, transaction *Transaction) error {
if err != nil {
return err
}
log.Printf("%+v\n\n%+v", req, resp)
return errors.New("not impl")
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(resp.Body)
return fmt.Errorf("bad status from todo: %v: %s", resp.StatusCode, b)
}
return nil
}