How to use the requestretry.post function in requestretry

To help you get started, we’ve selected a few requestretry 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 hdnpt / geartrack / src / malaysiaPosTracker.js View on Github external
function obtainInfo(action, id, cb) {
    request.post({
        url: action,
        form: {
            trackingNo03: id
        },
        timeout: 20000
    }, function (error, response, body) {
        if (error || response.statusCode != 200) {
            cb(utils.errorDown())
            return
        }

        // Not found
        if (body.indexOf('Please insert the correct Tracking Number.') != -1) {
            cb(utils.errorNoData())
            return
        }
github hyperflow-wms / hyperflow / functions / awsLambdaCommand.js View on Github external
"args": config.executor.args,
        "env": (config.executor.env || {}),
        "inputs": ins.map(i => i),
        "outputs": outs.map(o => o),
        "options": options,
        "stdout": config.executor.stdout,
        "logName": logName
    };

    const url = executor_config.service_url;

    console.log("Executing: " + JSON.stringify(jobMessage) + "@" + url);

    const fireTime = Date.now();

    request.post({
        timeout: 600000,
        url: url,
        json: jobMessage,
        retryStrategy: retry,
        headers: {'Content-Type': 'application/json', 'Accept': '*/*'}
    })
        .then(async function (response) {
            if (response) {
                console.log("Function: " + executable + " response status code: " + response.statusCode + " number of request attempts: " + response.attempts)
            }
            if (executor_config.S3_metrics) {
                await waitForLogs(1)
            } else {
                console.log("Metrics: task: " + executable + " fire time " + fireTime + " " + response.body);
            }
            console.log("Lambda task: " + executable + " completed successfully.");
github hyperflow-wms / hyperflow / functions / RESTServiceCommand.js View on Github external
function requestCb(err, response, body) {
        if (err) {
            console.log("Function: " + executable + " error: " + err);
            cb(err, outs);
            return
        }
        if (response) {
             console.log("Function: " + executable + " response status code: " + response.statusCode + " number of request attempts: " + response.attempts)
        }
        console.log("Function: " + executable + " data: " + body.toString());
        cb(null, outs);
    }


    var req = request.post(
        {timeout:600000, url:url, json:jobMessage, headers: {'Content-Type' : 'application/json', 'Accept': '*/*'}}, requestCb);


}
github SpencerSharkey / node-pogo-signature / lib / utils.js View on Github external
return new Promise((resolve, fail) => {
        const url = require('url').parse(this.pokeHashUrl);
        const _http = url.protocol == 'https' ? https : http;
        
        request.post(this.pokeHashUrl, {
            headers: {
                "X-AuthToken": this.pokeHashKey,
                "content-type": "application/json",
                "User-Agent": "node-pogo-signature"
            },
            body: requestData,
            followAllRedirects: true,
            gzip: true,
            method: "POST",
            timeout: 5000,
            maxAttempts: 5,
            retryDelay: 1,
            retryStrategy: retryStrat
        }, (err, res, data) => {
            if(err){
                return fail(err);
github hdnpt / geartrack / src / track24.js View on Github external
function obtainInfo(action, id, cb) {
    request.post({
        url: action,
        form: {
            code: id,
            lng: 'en',
            type: 'update'
        },
        headers: {
            'Referer': 'https://track24.net',
            'Origin': 'https://track24.net'
        },
        timeout: 20000,
        maxAttempts: 2,
    }, function (error, response, body) {
        if (error || response.statusCode != 200) {
            cb(utils.errorDown())
            return

requestretry

request-retry wrap nodejs request to retry http(s) requests in case of error

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Similar packages