I'm trying to get an app running to pull data from a variety of
streaming APIs. I'm staring with the Twitter API and will be moving to
others following. I'd prefer not to use an API-specific gem like
TweetStream so I can reuse code and make things more efficient.

I'm using YAJL (open to suggestions on other gems) to pull from the
stream, but am getting an error when connecting. My code for the
connection is: (username/password removed):

max_allowed_errors = 1200
consecutive_errors = 0
while consecutive_errors < max_allowed_errors do
url =
URI.parse("https://[username]:[password]!@stream.twitter.com/1/statuses/sample.json")
begin
Yajl::HttpStream.get(url) do |status|
consecutive_errors = 0
# puts status.inspect
end
rescue Yajl::HttpStream::InvalidContentType
consecutive_errors += 1
end
sleep(0.25*consecutive_errors)
end

The error is:

Yajl::HttpStream::HttpError in DashboardsController#streamit

Code 200 expected got 0

The error refers to this line:

Yajl::HttpStream.get(url) do |status|


Appreciate any support on getting this running.

Thanks,
-matthew

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJun 13, '12 at 3:45p
activeJun 13, '12 at 3:45p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Matthew vb: 1 post

People

Translate

site design / logo © 2021 Grokbase