Matthew Purdy
2012-Mar-07 00:55 UTC
twitter api works with curl; but doesnt work with twitter-stream???
can anyone tell me why connecting to twitter using curl works and with twitter-stream it doesnt (i am using the example code from the gem website on github: https://github.com/voloko/twitter-stream/blob/master/examples/reader.rb using curl: echo ''track=software,ruby,rails,grails,torquebox,spring,tomcat,jboss'' > track.in curl -d @track.in https://stream.twitter.com/1/statuses/filter.json-uUSERNAME:PASSWORD everything works: however when using twitter-stream; i get rejected (something with ssl; however, i dont know why the curl client works) require ''rubygems'' require ''twitter/json_stream'' username=''user'' password=''password'' username=ARGV[0] if ARGV[0] password=ARGV[1] if ARGV[1] auth="#{username}:#{password}" puts "running twitter with auth => #{auth}" EventMachine::run { stream = Twitter::JSONStream.connect( :path => ''/1/statuses/filter.json'', :auth => auth, :method => ''POST'', #:ssl => true, :content => ''track=software,ruby,rails,grails,torquebox,spring,tomcat,jboss'' ) stream.each_item do |item| $stdout.print "item: #{item}\n" $stdout.flush end stream.on_error do |message| $stdout.print "error: #{message}\n" $stdout.flush end stream.on_reconnect do |timeout, retries| $stdout.print "reconnecting in: #{timeout} seconds\n" $stdout.flush end stream.on_max_reconnects do |timeout, retries| $stdout.print "Failed after #{retries} failed reconnects\n" $stdout.flush end trap(''TERM'') { stream.stop EventMachine.stop if EventMachine.reactor_running? } } puts "The event loop has ended" -- Thank You, Matthew Purdy ------------------------------------------------------------------------------------------------------------------ Matthew Purdy mpurdy1973userGroups-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 443.848.1595 -------------------------------------- "Lead, follow, or get out of the way." -- Thomas Paine "Make everything as simple as possible, but not simpler." -- Albert Einstein "The definition of insanity is doing the same thing over and over and expecting a different result." -- Benjamin Franklin "We can''t solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein ------------------------------------------------------------------------------------------------------------------ -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.