<commit_before>require 'faraday_middleware'

module Guardian
  module Connection

    private

    def connection
      options = {
        ssl: { verify: false },
        url: base_url
      }

      Faraday.new(options) do |connection|
        connection.use Faraday::Request::UrlEncoded
        connection.use Faraday::Response::RaiseError
        connection.use Faraday::Response::Mashify
        connection.use Faraday::Response::ParseJson
        connection.adapter(Faraday.default_adapter)
      end
    end
  end
end<commit_msg>Adds user agent to request headers<commit_after>require 'faraday_middleware'
require_relative 'version'

module Guardian
  module Connection

    HEADERS = { user_agent: "guardian_api gem #{Guardian::Version}" }

    private

    def connection
      options = {
        headers: HEADERS,
        ssl: { verify: false },
        url: base_url
      }

      Faraday.new(options) do |connection|
        connection.use Faraday::Request::UrlEncoded
        connection.use Faraday::Response::RaiseError
        connection.use Faraday::Response::Mashify
        connection.use Faraday::Response::ParseJson
        connection.adapter(Faraday.default_adapter)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08299096138044372, 'fraction_numerical': 0.0, 'mean_word_length': 2.8666666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6170283', 'n_tokens_mistral': 359, 'n_tokens_neox': 329, 'n_words': 75}