| //url := "http://vimeo.com/api/v2/brad/info.json" | //url := "http://vimeo.com/api/v2/brad/info.json" | ||||
| url := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APIConfig.Appid, APIConfig.AppSecret) | url := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APIConfig.Appid, APIConfig.AppSecret) | ||||
| var myClient = &http.Client{Timeout: 20 * time.Second} | var myClient = &http.Client{Timeout: 20 * time.Second} | ||||
| log.Println("renew access token from Internet api.weixin.qq.com") | |||||
| r, err := myClient.Get(url) | r, err := myClient.Get(url) | ||||
| if err != nil { | if err != nil { | ||||
| log.Fatal("http access api.weixin.qq.com failed") | |||||
| log.Fatal(err) | |||||
| return AuthToken{}, err | return AuthToken{}, err | ||||
| } | } | ||||
| defer r.Body.Close() | defer r.Body.Close() |