Forum: Ruby Timeout error--newbie needs help, please

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E9c2cadf102a718927da2fc9929f1a68?d=identicon&s=25 LinuxMercedes (Guest)
on 2009-01-16 17:05
(Received via mailing list)
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!
This topic is locked and can not be replied to.