github.com/gospider007/requests@v0.0.0-20240506025355-c73d46169a23/README.md (about) 1 <p align="center"> 2 <a href="https://github.com/gospider007/requests"><img src="https://go.dev/images/favicon-gopher.png"></a> 3 </p> 4 <p align="center"><strong>Requests</strong> <em>- A next-generation HTTP client for Golang.</em></p> 5 <p align="center"> 6 <a href="https://github.com/gospider007/requests"> 7 <img src="https://img.shields.io/github/last-commit/gospider007/requests"> 8 </a> 9 <a href="https://github.com/gospider007/requests"> 10 <img src="https://img.shields.io/badge/build-passing-brightgreen"> 11 </a> 12 <a href="https://github.com/gospider007/requests"> 13 <img src="https://img.shields.io/badge/language-golang-brightgreen"> 14 </a> 15 </p> 16 17 Requests is a fully featured HTTP client library for Golang. Network requests can be completed with just a few lines of code 18 --- 19 ## Features 20 * [Simple for settings and Request](https://github.com/gospider007/requests#quickly-send-requests) 21 * [Request](https://github.com/gospider007/requests/tree/master/test/request) Support Automatic type conversion, Support orderly map 22 * [Json Request](https://github.com/gospider007/requests/blob/master/test/request/json_test.go) with `application/json` 23 * [Data Request](https://github.com/gospider007/requests/blob/master/test/request/data_test.go) with `application/x-www-form-urlencoded` 24 * [Form Request](https://github.com/gospider007/requests/blob/master/test/request/form_test.go) with `multipart/form-data` 25 * [Upload File Request](https://github.com/gospider007/requests/blob/master/test/request/file_test.go) with `multipart/form-data` 26 * [Flow Request](https://github.com/gospider007/requests/blob/master/test/request/stream_test.go) 27 * [Request URL Path Params](https://github.com/gospider007/requests/blob/master/test/request/params_test.go) 28 * [Local network card](https://github.com/gospider007/requests/blob/master/test/request/localAddr_test.go) 29 * [Response](https://github.com/gospider007/requests/tree/master/test/response) 30 * [Return whether to reuse connections](https://github.com/gospider007/requests/blob/master/test/response/isNewConn_test.go) 31 * [Return Raw Connection](https://github.com/gospider007/requests/blob/master/test/response/rawConn_test.go) 32 * [Return Proxy](https://github.com/gospider007/requests/blob/master/test/response/useProxy_test.go) 33 * [Middleware](https://github.com/gospider007/requests/tree/master/test/middleware) 34 * [Option Callback Method](https://github.com/gospider007/requests/blob/master/test/middleware/optionltCallBack_test.go) 35 * [Result Callback Method](https://github.com/gospider007/requests/blob/master/test/middleware/resultCallBack_test.go) 36 * [Error Callback Method](https://github.com/gospider007/requests/blob/master/test/middleware/errCallBack_test.go) 37 * [Request Callback Method](https://github.com/gospider007/requests/blob/master/test/middleware/requestCallback_test.go) 38 * [Retry](https://github.com/gospider007/requests/blob/master/test/middleware/try_test.go) 39 * [Protocol](https://github.com/gospider007/requests/tree/master/test/protocol) 40 * [HTTP1](https://github.com/gospider007/requests/blob/master/test/protocol/http1_test.go) 41 * [HTTP2](https://github.com/gospider007/requests/blob/master/test/protocol/http2_test.go) 42 * [WebSocket](https://github.com/gospider007/requests/blob/master/test/protocol/websocket_test.go) 43 * [SSE](https://github.com/gospider007/requests/blob/master/test/protocol/sse_test.go) 44 * [Fingerprint](https://github.com/gospider007/requests/tree/master/test/fingerprint) 45 * [Ja3 Fingerprint](https://github.com/gospider007/requests/blob/master/test/fingerprint/ja3_test.go) 46 * [Http2 Fingerprint](https://github.com/gospider007/requests/blob/master/test/fingerprint/http2_test.go) 47 * [Ja4 Fingerprint](https://github.com/gospider007/requests/blob/master/test/fingerprint/ja4_test.go) 48 * [Session](https://github.com/gospider007/requests/blob/master/test/session_test.go) 49 * [IPv4, IPv6 Address Control Parsing](https://github.com/gospider007/requests/blob/master/test/addType_test.go) 50 * [DNS Settings](https://github.com/gospider007/requests/blob/master/test/dns_test.go) 51 * [Proxy](https://github.com/gospider007/requests/blob/master/test/proxy_test.go) 52 * [Well tested client library](https://github.com/gospider007/requests/tree/master/test) 53 ## [Benchmark](https://github.com/gospider007/benchmark) 54 [gospider007/requests](https://github.com/gospider007/requests) > [imroc/req](github.com/imroc/req) > [go-resty](github.com/go-resty/resty) > [wangluozhe/requests](github.com/wangluozhe/requests) > [curl_cffi](https://github.com/yifeikong/curl_cffi) > [httpx](https://github.com/encode/httpx) > [psf/requests](https://github.com/psf/requests) 55 ## Supported Go Versions 56 Recommended to use `go1.21.3` and above. 57 Initially Requests started supporting `go modules` 58 59 ## Installation 60 61 ```bash 62 go get github.com/gospider007/requests 63 ``` 64 ## Usage 65 ```go 66 import "github.com/gospider007/requests" 67 ``` 68 ### Quickly Send Requests 69 ```go 70 package main 71 72 import ( 73 "log" 74 "time" 75 "github.com/gospider007/requests" 76 ) 77 78 func main() { 79 resp, err := requests.Get(nil, "http://httpbin.org/anything") 80 if err != nil { 81 log.Panic(err) 82 } 83 log.Print(resp.Text()) // Get content and parse as string 84 log.Print(resp.Content()) // Get content as bytes 85 log.Print(resp.Json()) // Get content and parse as gjson JSON 86 log.Print(resp.Html()) // Get content and parse as goquery DOM 87 log.Print(resp.Cookies()) // Get cookies 88 } 89 ``` 90 91 # Contributing 92 If you have a bug report or feature request, you can [open an issue](../../issues/new) 93 # Contact 94 If you have questions, feel free to reach out to us in the following ways: 95 * QQ Group (Chinese): 939111384 - <a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=yI72QqgPExDqX6u_uEbzAE_XfMW6h_d3&jump_from=webapi"><img src="https://pub.idqqimg.com/wpa/images/group.png"></a> 96 * WeChat (Chinese): gospider007 97 98 ## Sponsors 99 If you like and it really helps you, feel free to reward me with a cup of coffee, and don't forget to mention your github id. 100 <table> 101 <tr> 102 <td align="center"> 103 <img src="https://github.com/gospider007/tools/blob/master/play/wx.jpg?raw=true" height="200px" width="200px" alt=""/> 104 <br /> 105 <sub><b>Wechat</b></sub> 106 </td> 107 <td align="center"> 108 <img src="https://github.com/gospider007/tools/blob/master/play/qq.jpg?raw=true" height="200px" width="200px" alt=""/> 109 <br /> 110 <sub><b>Alipay</b></sub> 111 </td> 112 </tr> 113 </table>