2011-09-27 46 views
0

运行Twitter gem版本1.7.2,OSX Lion,Ruby 1.9.2。Twitter的建议返回404?

在Rails控制台..如果你把:

client = Twitter::Client.new(:oauth_token => actual_token_here, :oauth_token_secret => actual_secret_here) 
client.suggestions('entertainment') 

它从Twitter的API检索结果。但是:

client = Twitter::Client.new 
client.suggestions('entertainment') 

返回相同的错误:

Twitter::NotFound: GET https://api.twitter.com/1/users/suggestions/entertainment.json: 404: Can't find that category 

https://dev.twitter.com/docs/api/1/get/users/suggestions/%3Aslug建议您不需要进行身份验证,使这个API调用。

所以不应该没有令牌的工作呢? 奇怪的是,我已经要求别人在他们的开发机器上做到这一点,它工作正常。我不知道从哪里出发。我如何追踪问题的来源?

这是完整的跟踪:

Twitter::NotFound: GET https://api.twitter.com/1/users/suggestions/entertainment.json: 404: Can't find that category 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/twitter-1.7.2/lib/faraday/response/raise_http_4xx.rb:16:in `on_complete' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/response.rb:9:in `block in call' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/response.rb:62:in `on_complete' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/response.rb:8:in `call' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/request/url_encoded.rb:14:in `call' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/request/multipart.rb:13:in `call' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/twitter-1.7.2/lib/faraday/request/multipart_with_file.rb:18:in `call' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/connection.rb:203:in `run_request' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/faraday-0.7.4/lib/faraday/connection.rb:85:in `get' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/twitter-1.7.2/lib/twitter/request.rb:27:in `request' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/twitter-1.7.2/lib/twitter/request.rb:6:in `get' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/twitter-1.7.2/lib/twitter/client/user.rb:117:in `suggestions' 
from (irb):2 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start' 
from /Users/Chris/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top (required)>' 
from script/rails:6:in `require' 
from script/rails:6:in 

回答

0

Errr。出于某种原因,我需要指定lang参数。例如:现在

client.suggestions("entertainment", :lang => "en") 

作品!