<commit_before><commit_msg>HTTP get request helper<commit_after>//Gets Heimdall API data from a server

var url = require('url');

var protocol;

var Client = module.exports = {};

Client.get = function(uri,callback) {

	uri = url.parse(uri);

	protocol = require(uri.protocol.substr(0,uri.protocol.length-1));

	protocol.get(uri,function(res){

		var data = "";

	    res.on('data', function(chunk) { data+=chunk; });

	    res.on('end', function() {
	    	var json = null;
	    	try {
	    		json = JSON.parse(data);
	    	} catch(ex) {
	    		callback(ex);
	    	}
	    	if (json) callback(null,json);
	    });

	}).on('error',callback);

}
{'fraction_non_alphanumeric': 0.17262830482115085, 'fraction_numerical': 0.003110419906687403, 'mean_word_length': 3.1019108280254777, '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': '2784607', 'n_tokens_mistral': 239, 'n_tokens_neox': 220, 'n_words': 44}