获取一个月中的法定假日和工作日
https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020101&ie=utf8&oe=utf-8&co=&resource_id=39043&t=1590458044226&format=json&tn=wisetpl
- 注意 日期格式 yyyymd
go demo
query:=url.QueryEscape("2020年5月")
urlApi:="https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query="+query+"&ie=utf8&oe=utf-8&co=&resource_id=39043&t=1590458044226&format=json&tn=wisetpl"
accessReq:=httplib.Get(urlApi)
accessReq.Header("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36")
accessReq.Header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")accessReq.SetTLSClientConfig(&tls.Config{InsecureSkipVerify:true})
accessReq.SetTimeout(100*time.Second, 30*time.Second).Response()
accessStr,accessErr:=accessReq.String()
if accessErr!=nil{
fmt.Println("接口出现错误")
}
result:=make(map[string]interface{})
json.Unmarshal([]byte(accessStr),&result)
fmt.println(result)
curl请求
curl "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query=2020%E5%B9%B41%E6%9C%88&co=&resource_id=39043&t=1590458044226&ie=utf8&oe=gbk&format=json&tn=wisetpl"
网友评论