Point Tools token is now command-line parameter.

This commit is contained in:
Alexey Skobkin 2016-03-22 22:57:47 +03:00
parent a2e6e55e36
commit ac668ee2cd

View file

@ -11,10 +11,11 @@ import (
) )
func main() { func main() {
var login, password string var login, password, pointToolsToken string
flag.StringVar(&login, "l", "", "Account login") flag.StringVar(&login, "l", "", "Account login")
flag.StringVar(&password, "p", "", "Account password") flag.StringVar(&password, "p", "", "Account password")
flag.StringVar(&pointToolsToken, "t", "", "Point Tools crawler API token")
flag.Parse() flag.Parse()
if len(login) < 1 || len(password) < 1 { if len(login) < 1 || len(password) < 1 {
@ -22,8 +23,13 @@ func main() {
return return
} }
if len(pointToolsToken) < 1 {
fmt.Println("Point Tools token must be defined")
return
}
pointClient := point.NewClient("https://point.im/api/") pointClient := point.NewClient("https://point.im/api/")
pointToolsClient := point_tools.NewClient("http://point-tools.local:8000/api/crawler/", "test_token") pointToolsClient := point_tools.NewClient("http://point-tools.local:8000/api/crawler/", pointToolsToken)
_, loginErr := pointClient.Login(login, password) _, loginErr := pointClient.Login(login, password)