excon

Http(s) EXtended CONnections

Getting Started

sudo gem install excon

Now you are ready to get started, easiest is to use one off requests to start.

Excon.get('http://geemus.com')

This will return a response object, which has body, headers and status attributes you can check out.

This supports all the major http verbs: [connect, delete, get, head, options, post, put, trace]

You can also create a connection to try and keep open across multiple requests.

connection = Excon.new('http://geemus.com')
connection.request(:method => 'GET')

You can also specify more complicated options to either style of call

Excon.get('http://geemus.com', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
# or
connection.request(:method => 'GET', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})

If you need to do something special with a response you can also pass a block that will be called with each chunk.

Excon.get('http://geemus.com') {|chunk| p chunk }

From there you should be able to make just about any request you might need.

(The MIT License)

Copyright © 2010 geemus (Wesley Beary)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.