<commit_before>var config;
try {
  config = require('./config');
}
catch (err) {
}
var util = require('util');
var url = require('url');
var http = require('http');

module.exports = search;

function search(opts, callback) {
  if (!opts.url) {
    opts.url = 'https://api.untappd.com/v4/search/beer?q=';
  }
  opts.url += opts.name;
  opts.url += util.format('&client_id=%s&client_secret=%s&access_token=%s', config.client_id, config.client_secret, config.access_token);
  var urlopts = url.parse(opts.url);
  urlopts.method = 'GET';
  urlopts.withCredentials = false;
  var req = http.request(urlopts, function(res) {
    var buffer = '';
    res.on('data', function(d) {
      buffer += d;
    });
    res.on('end', function() {
      console.log(buffer);
      var json;
      try {
        json = JSON.parse(buffer);
      }
      catch (err) {
        callback(err);
        return;
      }
      callback(null, json);
    });
  });<commit_msg>Specifically use https for requests on the tappd.<commit_after>var config;
try {
  config = require('./config');
}
catch (err) {
  console.log(err)
}
var util = require('util');
var url = require('url');
var https = require('https');

module.exports = search;

function search(opts, callback) {
  if (!opts.url) {
    opts.url = 'https://api.untappd.com/v4/search/beer?q=';
  }
  opts.url += opts.name;
  opts.url += util.format('&client_id=%s&client_secret=%s&access_token=%s', config.client_id, config.client_secret, config.access_token);
  var urlopts = url.parse(opts.url);
  urlopts.method = 'GET';
  urlopts.withCredentials = false;
  var req = https.request(urlopts, function(res) {
    var buffer = '';
    res.on('data', function(d) {
      buffer += d;
    });
    res.on('end', function() {
      console.log(buffer);
      var json;
      try {
        json = JSON.parse(buffer);
      }
      catch (err) {
        callback(err);
        return;
      }
      callback(null, json);
    });
  });
{'fraction_non_alphanumeric': 0.17568947906026558, 'fraction_numerical': 0.0010214504596527069, 'mean_word_length': 2.9575757575757575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2515461', 'n_tokens_mistral': 670, 'n_tokens_neox': 672, 'n_words': 134}