Timeout error--newbie needs help, please

L

LinuxMercedes

Hi,

I'm trying to interface with NewsGator's API, which is a RESTful
interface. I'm using their sample code:

def loadLocations(username, password)
http = Net::HTTP.start('services.newsgator.com')
req = Net::HTTP::Get.new('/ngws/svc/Location.aspx')
req['X-NGAPIToken'] = API_PRODUCT_KEY
req.basic_auth username,password
http.request(req) { |response| locationsLoaded(response) }
end

def locationsLoaded(response)
printf response
end

but when I execute this (with the username, password, and
API_PRODUCT_KEY set correctly), I get a printout of the locations
followed by a timeout error:

ml>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::Error)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/timeout.rb:56:in `timeout'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/timeout.rb:76:in `timeout'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/protocol.rb:86:in `read'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/http.rb:2221:in `read_body_0'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/http.rb:2182:in `read_body'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/http.rb:2207:in `body'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/http.rb:2146:in `reading_body'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/net/http.rb:1061:in `request'
from app.rb:14:in `loadLocations'
from app.rb

(app.rb is the name of my program at the moment)
Any code written after calling loadLocations is not executed.

Can anyone explain to me what mistake I'm making? Or at least tell me
"Stupid, go read <this_cool_ruby_webpage> and you'll figure it out
yourself"

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top