https://github.com/levigross/grequests
A Go "clone" of the great and famous Requests library
https://github.com/levigross/grequests
golang golang-package grequests http-client requests
Last synced: about 1 month ago
JSON representation
A Go "clone" of the great and famous Requests library
- Host: GitHub
- URL: https://github.com/levigross/grequests
- Owner: levigross
- License: apache-2.0
- Archived: true
- Created: 2015-06-11T16:41:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2026-07-02T10:48:05.000Z (5 months ago)
- Last Synced: 2026-10-03T20:42:57.670Z (about 2 months ago)
- Topics: golang, golang-package, grequests, http-client, requests
- Language: Go
- Homepage:
- Size: 171 KB
- Stars: 2,181
- Watchers: 32
- Forks: 135
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-extra - grequests - A Go "clone" of the great and famous Requests library (Networking / HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library - ★ 1173 (Utilities)
- awesome-go - levigross/grequests - A Go "clone" of the great and famous Requests library *(archived)* (Web / HTTP and Networking Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. Stars:`2.2K`. (Networking / HTTP Clients)
- awesome-go-cn - grequests - star:1081 遵循Python请求库的优雅和简单的`net / http`包装器。 (Elegant and simple `net/http` wrapper that follows Python's requests library.) (实用工具)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - | - | - | (Networking / HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. - :arrow_down:68 - :star:750 (Networking / HTTP Clients)
- awesome-Char - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go-cn - grequests - 著名的请求库的`Go`版本。 (网络相关库 / Http Client)
- zero-alloc-awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go-cn - grequests
- fucking-awesome-go - :octocat: grequests - An elegant and simple `net/http` wrapper that follows Python's requests library :star: 721 :fork_and_knife: 32 (Utilities / Advanced Console UIs)
- fucking-awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - Elegant and simple `net/http` wrapper that follows Python's requests library. (Utilities / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go - grequests - Elegant and simple `net/http` wrapper that follows Python's requests library. (Utilities)
- awesome-go-cn - grequests
- awesome-go-info - grequests - A Go "clone" of the great and famous Requests library. (HTTP Clients)
- awesome-go - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go-processed - grequests - Elegant and simple `net/http` wrapper that follows Python's requests library.| (Utilities / Advanced Console UIs)
- go-awesome-with-star-updatetime - grequests - A Go "clone" of the great and famous Requests library. (Networking / HTTP Clients)
- awesome-go-plus - grequests - A Go "clone" of the great and famous Requests library.  (Networking / HTTP Clients)
- awesome-go-zh - grequests - | 雅致简约`net/http`遵循Python请求库的包装器. (工具库)
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.
[](https://gitter.im/levigross/grequests?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## 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
```bash
go get github.com/levigross/grequests/v2
```
## Quick start
```go
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)
}
```
### Uploading a file
```go
fd, _ := grequests.FileUploadFromDisk("testdata/file.txt")
ro := &grequests.RequestOptions{
Files: fd,
Data: map[string]string{"desc": "test"},
}
resp, err := grequests.Post(context.Background(), "https://httpbin.org/post",
grequests.FromRequestOptions(ro))
```
### Using a session
```go
sess := grequests.NewSession(nil)
_, _ = sess.Get(context.Background(), "https://httpbin.org/cookies/set?one=two", nil)
resp, _ := sess.Get(context.Background(), "https://httpbin.org/cookies", nil)
log.Println(resp.String())
```
See the documentation for a full list of available options.
## License
GRequests is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.