# Timeout error--newbie needs help, please

**URL:** <https://www.ruby-forum.com/t/timeout-error-newbie-needs-help-please/157931>\
**Category:** Ruby\
**Created:** [January 16, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/timeout-error-newbie-needs-help-please/157931 "2009-01-16T17:05:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LinuxMercedes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e99b99/32.png) [@LinuxMercedes](https://www.ruby-forum.com/u/LinuxMercedes)\
**Post date:** [January 16, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/timeout-error-newbie-needs-help-please/157931/1 "2009-01-16T17:05:45Z")

</div>

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](http://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!
