<commit_before>exports.OAuth = (function () {
    var oa = require('oauth').OAuth;

    return {
        init: function (key, secret) {
            oauth = new oa(
                'https://www.odesk.com/api/auth/v1/oauth/token/request',
                'https://www.odesk.com/api/auth/v1/oauth/token/access',
                key,
                secret,
                '1.0',
                null,
                'HMAC-SHA1',
                32,
                {
                    'Accept' : 'application/json',
                    'Connection' : 'close',
                    'User-Agent': 'odesk.js'
                });
        },
        getRequestToken: function(callback) {
            oauth.getOAuthRequestToken(function (error, requestToken, requestTokenSecret) {
                callback(error, requestToken, requestTokenSecret);
            });
        },
        getAccessToken: function (requestToken, requestTokenSecret, verifier, callback) {
            oauth.getOAuthAccessToken(requestToken, requestTokenSecret, verifier, function (error, accessToken, accessTokenSecret) {
                callback(error, accessToken, accessTokenSecret);
            });
        },
        getAuthenticateUrl: function(token) {
            return 'https://www.odesk.com/services/api/auth?oauth_token=' + token;
        },
        get: function (url, params, callback) {
            var https = require('https');
            var qs = require('querystring');

            url = params ? url + '?' + qs.stringify(params) : url;
            var signedUrl = oauth.signUrl(url, this.accessToken, this.accessTokenSecret, 'get');
            signedUrl = require('url').parse(signedUrl);

            var options = {
                "host": signedUrl.host,
                "path": signedUrl.path,
                "method": 'GET'
            };

            var resData = "";
            var req = https.request(options, function(res) {
                res.setEncoding('utf8');
                res.on('data', function (data) {
                    resData = resData + data;
                });
                res.on('error', function (data) {
                    resData = resData + data;
                    callback(data);
                });
                res.on('end', function (data) {
                    callback(null, JSON.parse(resData));<commit_msg>Added _request method<commit_after>exports.OAuth = (function () {
    var oa = require('oauth').OAuth;

    return {
        init: function (key, secret) {
            oauth = new oa(
                'https://www.odesk.com/api/auth/v1/oauth/token/request',
                'https://www.odesk.com/api/auth/v1/oauth/token/access',
                key,
                secret,
                '1.0',
                null,
                'HMAC-SHA1',
                32,
                {
                    'Accept' : 'application/json',
                    'Connection' : 'close',
                    'User-Agent': 'odesk.js'
                });
        },
        getRequestToken: function(callback) {
            oauth.getOAuthRequestToken(function (error, requestToken, requestTokenSecret) {
                callback(error, requestToken, requestTokenSecret);
            });
        },
        getAccessToken: function (requestToken, requestTokenSecret, verifier, callback) {
            oauth.getOAuthAccessToken(requestToken, requestTokenSecret, verifier, function (error, accessToken, accessTokenSecret) {
                callback(error, accessToken, accessTokenSecret);
            });
        },
        getAuthenticateUrl: function(token) {
            return 'https://www.odesk.com/services/api/auth?oauth_token=' + token;
        },
        get: function (url, params, callback) {
            var qs = require('querystring');

            url = params ? url + '?' + qs.stringify(params) : url;
            var signedUrl = oauth.signUrl(url, this.accessToken, this.accessTokenSecret, 'get');
            signedUrl = require('url').parse(signedUrl);

            var options = {
                "host": signedUrl.host,
                "path": signedUrl.path,
                "method": 'GET'
            };

            this._request(options, callback);
        },
        _request: function (options, callback) {
            var https = require('https');

            var resData = "";
            var req = https.request(options, function(res) {
                res.setEncoding('utf8');
                res.on('data', function (data) {
                    resData = resData + data;
                });
                res.on('error', function (data) {
                    resData = resData + data;
                    callback(data);
                });
                res.on('end', function (data) {
                    callback(null, JSON.parse(resData));
{'fraction_non_alphanumeric': 0.12321095208462975, 'fraction_numerical': 0.003318813524165111, 'mean_word_length': 1.4791773778920307, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, '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': '2674944', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1228, 'n_words': 235}