PointToolsClient now have token in parameters.

This commit is contained in:
Alexey Skobkin 2016-03-22 22:50:04 +03:00
parent 1a46963be9
commit a2e6e55e36
2 changed files with 5 additions and 3 deletions

View File

@ -23,7 +23,7 @@ func main() {
}
pointClient := point.NewClient("https://point.im/api/")
pointToolsClient := point_tools.NewClient("http://point-tools.local:8000/api/crawler/")
pointToolsClient := point_tools.NewClient("http://point-tools.local:8000/api/crawler/", "test_token")
_, loginErr := pointClient.Login(login, password)

View File

@ -12,12 +12,14 @@ import (
type PointToolsClient struct {
client simple_http.Client
apiUrl string
token string
}
func NewClient(apiUrl string) PointToolsClient {
func NewClient(apiUrl, token string) PointToolsClient {
return PointToolsClient{
simple_http.Client{http.Client{}},
apiUrl,
token,
}
}
@ -42,7 +44,7 @@ func (c *PointToolsClient) SendPage(page point.Page) (ReceiveAllPageResponse, er
}
data := url.Values{}
data.Set("token", "test_token")
data.Set("token", c.token)
data.Add("json", jsonStr)
body, reqErr := c.client.MakePostRequest(c.apiUrl+"all/page", data, nil)