Running Twitter gem version 1.7.2, OSX Lion, Ruby 1.9.2.
In Rails console.. if you put:
client = Twitter::Client.new(:oauth_token => actual_token_here, :oauth_token_secret => actual_secret_here)
client.suggestions('entertainment')
It retrieves results from Twitter's API. But:
client = Twitter::Client.new
client.suggestions('entertainment')
Returns the same error:
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 suggests that you don't need to be authenticated to make this API call.
So shouldn't it work without the tokens as well? The strange this is , I've asked someone else to do this on their dev machine and it works fine. I don't know where to proceed from here. How can I track where the problem is coming from?
This is the full trace:
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
Errr. for some reason, I needed to specify the lang param. For example:
client.suggestions("entertainment", :lang => "en")
Works now!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.