cleverbot-api
cleverbot-api copied to clipboard
Incorrect header check error?
Whenever I make a request with this Cleverbot API it always has an error like this:
@cleverbotChats: ERROR: Zlib::DataError: incorrect header check
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:357:in finish' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:357:in
finish'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:262:in ensure in inflater' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:262:in
inflater'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:274:in read_body_0' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:201:in
read_body'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1391:in block in send_entity' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1413:in
block (2 levels) in transport_request'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:162:in reading_body' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1412:in
block in transport_request'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in catch' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1403:in
transport_request'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1376:in request' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1369:in
block in request'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in start' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1367:in
request'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1390:in send_entity' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1179:in
post'
/Library/Ruby/Gems/2.0.0/gems/cleverbot-api-0.0.4/lib/cleverbot-api.rb:43:in make_request' /Library/Ruby/Gems/2.0.0/gems/cleverbot-api-0.0.4/lib/cleverbot-api.rb:23:in
think'
/Users/ryandolan123/cleverbot/bots.rb:58:in `block (2 levels) in <top (required)>'
Is this because of Cleverbot API changes? Or Ruby 2.0.0 incompatibility?
There seems to be a problem with the net/http library in Ruby 2.0+ related to decompressing gzipped headers. The fastest fix is to just use RestClient instead. In case you're still looking, you can use my fork at https://github.com/neilgupta/cleverbot-api for a working version:
gem 'cleverbot-api', :git => 'git://github.com/neilgupta/cleverbot-api.git'
@neilgupta When I try to put your line of code in my gem file and bundle install, it seems like the gem isn't actually being installed.
/Users/Charles/.rbenv/versions/2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- cleverbot-api (LoadError)
from /Users/Charles/.rbenv/versions/2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from bots.rb:1:in `<main>'
When I do the following it works:
- git clone 'git://github.com/neilgupta/cleverbot-api.git'
- cd cleverbot-api/
- gem build cleverbot-api.gemspec
- sudo gem install cleverbot-api
Is there something I'm missing? Ideally I want to be able to just stick your fork of cleverbot in my gemfile and bundle install without having to actually build the gem manually in the command line.
Apologies if I'm missing something obvious. My first time trying to pull gem from a github repo.
If you check your Gemfile.lock, do you see the cleverbot-api gem properly loaded from my github fork? If yes, my first guess would be this is a configuration problem with rbenv not finding the bundler installed gem, but it is able to find it when you install it to the whole system via gem install
.
Are you prefixing your start command with bundle exec (ie bundle exec rails s
)? If not, try that.