A Go "clone" of the great and famous Requests library
grequestsrequestsgolanggolang-packagehttp-client
Indicateurs clés
Croissance des étoiles
Étoiles
2.2k
Forks
138
Croissance hebdomadaire
—
Issues
23
1k1.5k2k
juin 2015avr. 2017févr. 2019déc. 2020nov. 2022sept. 2024juil. 2026
ArtefactsGo 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)
}