<commit_before>//
//     npm-pulse
//     Copyright(c) 2013 Applejacks
//     <NAME>, <NAME>, <NAME>
//     MIT Licensed
//

var request = require('request')
  , util    = require('util')
  , Q       = require('q')
  , path    = require('path');

const GITHUB_ROOT_URL = 'https://api.github.com';
const REPORT_CARD_URL = 'http://osrc.dfm.io/';
const UA_STRING       = 'applejacks/npm-pulse';

//
// Helper for getting data from GitHub.
//
var get = function get(uri) {
  var deferred = Q.defer();
  var opts = {
    methid: 'GET'
  , url: GITHUB_ROOT_URL + uri
  , json: true
  , headers: {
      'User-Agent': UA_STRING
    }
  };

  request(opts, function(err, response, body) {
    if (err) return deferred.reject(err);
    if (response.statusCode !== 200) return deferred.reject(new Error(body.message));

    deferred.resolve(body);
  });

  return deferred.promise;
};
<commit_msg>Include cient id/secret for unlimited requests.<commit_after>//
//     npm-pulse
//     Copyright(c) 2013 Applejacks
//     <NAME>, <NAME>, <NAME>
//     MIT Licensed
//

var request = require('request')
  , util    = require('util')
  , Q       = require('q')
  , path    = require('path');

const GITHUB_ROOT_URL = 'https://api.github.com';
const REPORT_CARD_URL = 'http://osrc.dfm.io/';
const UA_STRING       = 'applejacks/npm-pulse';

//
// Helper for getting data from GitHub.
//
var get = function get(uri) {
  var deferred = Q.defer();
  var opts = {
    methid: 'GET'
  , url: GITHUB_ROOT_URL + uri
  , json: true
  , headers: {
      'User-Agent': UA_STRING
    }
  , qs: {
      client_id: 'a43f95b2abce7c72fa0d'
    , client_secret: '771681a8a0c6998e3fa7c90c0a450bac5ffe7edb'
    }
  };

  request(opts, function(err, response, body) {
    if (err) return deferred.reject(err);
    if (response.statusCode !== 200) return deferred.reject(new Error(body.message));

    deferred.resolve(body);
  });

  return deferred.promise;
};

{'fraction_non_alphanumeric': 0.16026970954356848, 'fraction_numerical': 0.023340248962655602, 'mean_word_length': 2.8657314629258517, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '771013', 'n_tokens_mistral': 744, 'n_tokens_neox': 692, 'n_words': 150}