How to use the request-promise.get function in request-promise

To help you get started, we’ve selected a few request-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twitterdev / account-activity-dashboard / example_scripts / subscription_management / get-subscriptions-count.js View on Github external
auth.get_twitter_bearer_token().then(function (bearer_token) {

  // request options
  var request_options = {
    url: 'https://api.twitter.com/1.1/account_activity/all/count.json',
    auth: {
      'bearer': bearer_token
    }
  }

  request.get(request_options).then(function (body) {
    console.log(body)
  })
})
github twitterdev / account-activity-dashboard / example_scripts / subscription_management / get-subscriptions-list.js View on Github external
auth.get_twitter_bearer_token().then(function (bearer_token) {

  // request options
  var request_options = {
    url: 'https://api.twitter.com/1.1/account_activity/all/' + args.environment + '/subscriptions/list.json',
    auth: {
      'bearer': bearer_token
    }
  }
  console.log(request_options)
  request.get(request_options).then(function (body) {
    console.log(body)
  })
})
github juanfranblanco / vscode-solidity / src / analysis / mythx / compat / truffle-compile / compilerSupplier / loadingStrategies / VersionRange.ts View on Github external
public async getSolcByUrlAndCache(fileName) {
    const url = this.config.compilerUrlRoot + fileName;
    // const spinner = ora({
    //   color: 'red',
    //   text: 'Downloading compiler',
    // }).start();
    try {
      const response = await request.get(url);
      // spinner.stop();
      this.addFileToCache(response, fileName);
      return this.compilerFromString(response);
    } catch (error) {
      // spinner.stop();
      throw this.errors('noRequest', url, error);
    }
  }
github raulrene / twitter-contest-js-bot / api-functions.js View on Github external
new Promise((resolve, reject) =>
            request.get({url: `${rootUrl}/statuses/user_timeline.json?user_id=${userId}&count=${count}`, oauth})
                .then((response) => resolve(response))
                .catch((err) => reject(err))
        )
github saule1508 / pgcluster / manager / server / business / index.js View on Github external
const bus_health = (service) => {
  const request = require('request-promise');
  return request
    .get({ uri: `http://${service}:8080/health`, json: true })
    .then((response) => {
      console.log('in then');
      return response;
    })
    .catch((error) => {
      console.log('in catch');
      throw error;
    });
};
github AdguardTeam / AdGuardForSafari / ElectronMainApp / tasks / download-locales.js View on Github external
const request = (url, locale) => {
    return requestPromise.get(url)
        .then(res => {
            if (res.length) {
                const pathToFile = path.join(LOCALES_DIR, locale + '.json');
                return writeInFile(pathToFile, res);
            }
            return null;
        })
        .then(res => locale += res ? ' - OK' : ' - Empty')
        .catch(err => {
            console.log(err);
            return locale + ' - Not OK';
        });
};
github TrueLayer / truelayer-client-javascript / src / v1 / StatusAPIClient.ts View on Github external
public static async callAPI(
        path: string,
        qs?: object
    ): Promise> {
        const requestOptions = StatusAPIClient.buildRequestOptions(path, qs);
        try {
            const response = await request.get(requestOptions);
            const parsedResponse: IResult = JSON.parse(response);
            return parsedResponse;
        } catch (error) {
            throw new ApiError(error);
        }
    }
github ericnishio / instagram-save / lib / download-and-save.js View on Github external
request.head(downloadUrl, error => {
      if (error) {
        return reject(error);
      }

      request
        .get(downloadUrl)
        .pipe(fs.createWriteStream(filename))
        .on('close', () => {
          return resolve();
        });
    });
  });
github IBM / taxinomitis / src / lib / utils / wikimedia.ts View on Github external
'titles=Image:' + name + '&' +
                   'prop=imageinfo&' +
                   'iiprop=url&' +
                   'iiurlwidth=' + width + '&' +
                   'format=json';
    const apiHeaders = {
        'User-Agent' : 'https://machinelearningforkids.co.uk',
        'Accept': 'application/json',
    };

    const options = {
        headers : apiHeaders,
        json : true,
    };

    const body = await request.get(apiUrl, options);
    return body;
}

request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

ISC
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis