<commit_before>require 'ostruct'

module TyphoeusHydraSpecHelper
  class FakeTyphoeusHydraTimeoutError < StandardError; end
  class FakeTyphoeusHydraConnectError < StandardError; end


  def http_request(method, uri, options = {}, &block)
    uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
    response = Typhoeus::Request.run(uri,
      {
        :method  => method,
        :body    => options[:body],
        :headers => options[:headers],
        :timeout => 25000 # milliseconds
      }
    )
    raise FakeTyphoeusHydraTimeoutError.new if response.timed_out?
    if response.code == 0
      p response
      raise FakeTyphoeusHydraConnectError.new<commit_msg>Verbose output from curl in Typhoeus to see what's going on in Travis.<commit_after>require 'ostruct'

module TyphoeusHydraSpecHelper
  class FakeTyphoeusHydraTimeoutError < StandardError; end
  class FakeTyphoeusHydraConnectError < StandardError; end


  def http_request(method, uri, options = {}, &block)
    uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
    response = Typhoeus::Request.run(uri,
      {
        :method  => method,
        :body    => options[:body],
        :headers => options[:headers],
        :timeout => 25000, # milliseconds
        :verbose => true
      }
    )
    raise FakeTyphoeusHydraTimeoutError.new if response.timed_out?
    if response.code == 0
      p response
      raise FakeTyphoeusHydraConnectError.new
{'fraction_non_alphanumeric': 0.09826989619377163, 'fraction_numerical': 0.011072664359861591, 'mean_word_length': 3.265486725663717, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7055335', 'n_tokens_mistral': 478, 'n_tokens_neox': 457, 'n_words': 109}