FaradayRuby的HTTP 客户端
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
评论
IQHTTPServiceiOS 的 HTTP 客户端
IQHTTPService 是 iOS 的 HTTP 客户端,可以用很简单的方法创建 Web API
IQHTTPServiceiOS 的 HTTP 客户端
0
phpWebHacksPHP的HTTP客户端
phpWebHacks是一个采用PHP开发的高级的HTTP客户端,你只需要数行代码就可以用来模拟浏览器的真实访问行为而无需键盘和鼠标的动作。可以用它来完成HTTP的调试功能。示例代码<?phpi
phpWebHacksPHP的HTTP客户端
0
HttpfulPHP 的 HTTP 客户端
Httpful是一个简单的PHP5.3+的Http客户端。它的优点在高刻度性、简洁性、和灵活性,并提供基本的功能和灵活性帮助开发者完成工作,让功能易于实现。它有以下特征:可读的HTTP方法支持(GET
HttpfulPHP 的 HTTP 客户端
0
IQHTTPServiceiOS 的 HTTP 客户端
IQHTTPService是iOS的HTTP客户端,可以用很简单的方法创建WebAPI客户端。特性:异步,同步请求。多部分表单数据上传。GET,POST,PUT,DELETE支持。urlEncoded
IQHTTPServiceiOS 的 HTTP 客户端
0
BeckettPython的HTTP API客户端
Beckett是一个基于惯例的(convention-based)框架,是为了建设HTTPAPIs的Python接口。因为它是基于惯例的,它不需要使用魔法就能用语HTTPAPIs,像REST风格的UR
BeckettPython的HTTP API客户端
0
Leaps/HttpClientPHP的HTTP客户端
HttpClient 通过HTTP/HTTPS协议获取数据安装"require" : { "php"
Leaps/HttpClientPHP的HTTP客户端
0