GRequests Requests​ 库的 Go 版本 GRequests

blov2016-09-07 16:07:43 • 2744 次点击    
这是一个分享于 2016-09-07 16:07:43 的项目,其中的信息可能已经有所发展或是发生改变。

GRequests 是 Requests 库的 Go 版本。

特性

* 内置异步和同步函数

* 不依赖于外部库

* 支持 Go 1.3 + 版本

* 响应可以序列化为 JSON 和 XML 格式

* 简单文件上传

* 简单文件下载

* 支持 HTTP verbs GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS

安装

go get -u github.com/levigross/grequests

使用

import "github.com/levigross/grequests"

基础示例

基础 GET 请求:

resp, err := grequests.Get("http://httpbin.org/get", nil)
// You can modify the request by passing an optional RequestOptions struct
if err != nil {
    log.Fatalln("Unable to make request: ", err)
}
fmt.Println(resp.String())
// {
//   "args": {},
//   "headers": {
//     "Accept": "*/*",
//     "Host": "httpbin.org",

A Go "clone" of the great and famous Requests libraryRead More

Latest commit to the master branch on 5-8-2024
Download as zip
授权协议:
Apache
开发语言:
Google Go 查看源码»
操作系统:
跨平台
2744 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传