A Go "clone" of the great and famous Requests library
grequestsrequestsgolanggolang-packagehttp-client
Métricas principais
Crescimento de estrelas
Estrelas
2.2k
Forks
138
Crescimento semanal
—
Issues
23
1k1.5k2k
jun. de 2015abr. de 2017fev. de 2019dez. de 2020nov. de 2022set. de 2024jul. de 2026
ArtefatosGo Modulesgo get github.com/levigross/grequests
README
GRequests
GRequests provides a clean wrapper around Go's net/http package. It mimics the convenience of the Python Requests library while keeping the power and safety of Go.
Features
Simple helpers for every HTTP verb
Context aware request functions for easy cancellation
RequestOptions for headers, query parameters, proxies, cookies and more
Built in support for JSON and XML responses
File uploads and convenient download helpers
Session type for reusing cookies between requests
Installation
go get github.com/levigross/grequests/v2
Quick start
package main
import (
"context"
"log"
"github.com/levigross/grequests/v2"
)
func main() {
resp, err := grequests.Get(context.Background(), "https://httpbin.org/get",
grequests.UserAgent("MyAgent"))
if err != nil {
log.Fatal(err)
}
var data map[string]any
if err := resp.JSON(&data); err != nil {
log.Fatal(err)
}
log.Println(data)
}