mirror of
https://bitbucket.org/skobkin/point-tools-crawler.git
synced 2024-12-04 18:25:52 +00:00
PointToolsClient now have token in parameters.
This commit is contained in:
parent
1a46963be9
commit
a2e6e55e36
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue