sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.59k stars 1.31k forks source link

Twitter::Error::NotAcceptable #1004

Closed jedrekdomanski closed 11 months ago

jedrekdomanski commented 3 years ago

Following the documentation but get an error on streams

client = Twitter::Streaming::Client.new do |config|
      config.consumer_key = CONSUMER_KEY
      config.consumer_secret = CONSUMER_SECRET
      config.access_token = ACCESS_TOKEN
      config.access_token_secret = ACCESS_TOKEN_SECRET
    end

client.filter(tracks: ['bitcoin']) do |object|
    puts object.text if object.is_a?(Twitter::Tweet)
end

.rvm/gems/ruby-2.6.5/gems/twitter-7.0.0/lib/twitter/streaming/response.rb:24:in `on_headers_complete': Twitter::Error::NotAcceptable

According to the gem this error is raised when Twitter returns the HTTP status code 406 and according to Twitter docs 406 error code is returned when "an invalid format is specified in the request. Generally, this occurs where your client fails to properly include the headers to accept gzip encoding, but can occur in other circumstances as well." https://developer.twitter.com/en/support/twitter-api/error-troubleshooting Please update the streams to send proper request header.

chbrown1293 commented 2 years ago

@jedrekdomanski Have you found a workaround for this? Also have this problem.

jedrekdomanski commented 2 years ago

@jedrekdomanski Have you found a workaround for this? Also have this problem.

No, unfortunately not.

chbrown1293 commented 2 years ago

@sferik any ideas?