Requests-Go,一个类似于 Python Requests 的 Go 语言 HTTP 请求库。
go get github.com/solos/requests
package main import r "github.com/solos/requests" import "fmt" func main() { kwargs := r.M{} options := r.M{ "timeout": 10, } cookies := map[string]string{ "user": "solos", } headers := map[string]string{ "content-Type": "application/json", } data := map[string]string{ "hello": "world", } req := &r.Request{Args: kwargs} resp, _ := req.MakeRequest("GET", "http://www.example.com", r.Timeout(10), r.Headers(headers), r.Cookies(cookies), r.Options(options), r.Data(data)) fmt.Println(resp.Content) }