运行Twitter gem版本1.7.2,OSX Lion,Ruby 1.9.2。
在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 :(得分:0)
Errr。出于某种原因,我需要指定lang param。例如:
client.suggestions("entertainment", :lang => "en")
立即行动!