- 授权协议: MIT
- 开发语言: Ruby
- 操作系统: 跨平台
- 软件首页: https://github.com/lostisland/faraday
- 软件文档: https://github.com/lostisland/faraday/wiki
软件介绍
Faraday 是一个Ruby 的HTTP 客户端开发库,提供了一个通用的接口,支持如下适配器:
Net::HTTP
示例代码:
conn = Faraday.new(:url => 'http://sushi.com') do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
# set proxy with string
conn.options.proxy = "http://user:password@example.org/"
# set proxy with hash
conn.options.proxy = { :uri => 'http://user:passwordexample.org' }
# specify proxy user/pass
conn.options.proxy = { :uri => 'http://user:pass.org',
:user => 'user',
:password => 'pass' }
## GET ##
response = conn.get '/nigiri/sake.json' # GET http://sushi.com/nigiri/sake.json
response.body
conn.get '/nigiri', { :name => 'Maguro' } # GET /nigiri?name=Maguro
conn.get do |req| # GET http://sushi.com/search?page=2&limit=100
req.url '/search', :page => 2
req.params['limit'] = 100
end
## POST ##
conn.post '/nigiri', { :name => 'Maguro' } # POST "name=maguro" to http://sushi.com/nigiri
# post payload as JSON instead of "www-form-urlencoded" encoding:
conn.post do |req|
req.url '/nigiri'
req.headers['Content-Type'] = 'application/json'
req.body = '{ "name": "Unagi" }'
end
## Per-request options ##
conn.get do |req|
req.url '/search'
req.options.timeout = 5 # open/read timeout in seconds
req.options.open_timeout = 2 # connection open timeout in seconds
# set proxy with string
req.options.proxy = "http://user:password@example.org/"
# set proxy with hash
req.options.proxy = { :uri => 'http://user:passwordexample.org' }
# specify proxy user/pass
req.options.proxy = { :uri => 'http://user:pass.org',
:user => 'user',
:password => 'pass' }
end
网络经济的十种策略
(美)凯文・凯利 / 肖华敬/任平 / 广州出版社 / 2000-06 / 26.00元
全书介绍网络经济的十个新游戏规则,分别是:蜜蜂比狮子重要;级数比加法重要;普及比稀有重要;免费比利润重要;网络比公司重要;造山比登山重要;空间比场所重要;流动比平衡重要;关系比产能重要;机会比效率重要!一起来看看 《网络经济的十种策略》 这本书的介绍吧!
HEX CMYK 转换工具
HEX CMYK 互转工具
HEX HSV 转换工具
HEX HSV 互换工具
