How to use request-promise - 10 common examples

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 oznu / homebridge-config-ui-x / lib / pm.js View on Github external
constructor () {
    // load base paths where plugins might be installed
    this.paths = this.getBasePaths()

    // setup requests with default options
    this.rp = rp.defaults({json: true})

    // get npm path
    this.npm = this.getNpmPath()

    // pre-load installed plugins
    this.plugins = []
    this.getInstalled()
  }
github oznu / homebridge-config-ui-x / src / pm.ts View on Github external
constructor() {
    // load base paths where plugins might be installed
    this.paths = this.getBasePaths();

    // setup requests with default options
    this.rp = rp.defaults({ json: true });

    // get npm path
    this.npm = this.getNpmPath();

    // pre-load installed plugins
    this.plugins = [];
    this.getInstalled();
  }
github xavierchow / github-label-template / lib / label.js View on Github external
constructor(owner, repo, token) {
    this.owner = owner;
    this.repo = repo;
    this.token = token;
    this.rp = request.defaults({
      baseUrl: `${GH_HOST}/repos/${this.owner}/${this.repo}`,
      headers: {
        // Opt-in into the preview version in order to be able to work with label descriptions
        // See 
        Accept: 'application/vnd.github.symmetra-preview+json',
        'user-agent': 'gh-label',
      },
      json: true
    });
  }
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 tamarasaurus / immo-feed / scraper / src / notification / slack.ts View on Github external
export default function notify(updatedRecords: any[]) {
    const url = process.env.SLACK_WEBHOOK_URL

    if (!url || url.length === 0) throw Error('You have to specify the SLACK_WEBHOOK_URL in your environment variables')

    return request.post(url, {
        json: {
            channel: '#immo-feed',
            username: 'immo-feed',
            text: `:house: ${updatedRecords.length} new result(s) found`,
            icon_emoji: ':house:'
        }
    })
    .then(() => console.log('🔔  Slack notification sent'))
    .catch(err => console.log('🔔  Slack notification failed'))
}
github parse-community / parse-server / spec / JobSchedule.spec.js View on Github external
it('should fail creating a job with an invalid name', (done) => {
    const options = Object.assign({}, masterKeyOptions, {
      body: {
        job_schedule: {
          jobName: 'job'
        }
      }
    });
    rp.post(Parse.serverURL + '/cloud_code/jobs', options)
      .then(done.fail)
      .catch(() => done());
  });
github wobscale / EuIrcBot / modules / clojure / utils.js View on Github external
function addCookie(req, key, value) {
  const cookie = request.cookie(`${key}=${value}`);
  const jar = request.jar();
  jar.setCookie(cookie, req.uri.split('?')[0]);
  req.jar = jar;
  return req;
}

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