Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "requestretry in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'requestretry' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

'HTTP request can get [wp-property/composer.json].': function( done ) {
    //console.log( 'test one', 'http://' + module.host + ':3000/' );

    request.get( {
      followRedirect: false,
      timeout: 1000,
      headers: {
        host: process.env.CIRCLE_SHA1 + '-' + process.env.CIRCLE_BUILD_NUM + '.ngrok.io'
      },
      url: module.base_url + '/wp-content/plugins/wp-property-' + process.env.CIRCLE_SHA1 + '/composer.json'
    } , function checkResponse( error, resp, body ) {

      if( error ) {
        done( new Error( 'Can not reach WordPress at [' + module.base_url + '/wp-admin/admin-ajax.php].' ) );
      }
      // console.log( require( 'util' ).inspect( resp.headers, {showHidden: false, depth: 2, colors: true} ) );
      // console.log( 'resp.statusCode', resp.statusCode );

      if( resp.statusCode === 301 ) {
        console.log( "Most likely first time tests are being ran and site is trying to redirect to its default siteurl." );
ArXiv.prototype.pageQuery = function () {
  var arxiv = this

  var thisQueryUrl = arxiv.queryurl

  var pageterm =
    '&start=' + arxiv.iter +
    '&max_results=' + arxiv.pagesize
  thisQueryUrl += pageterm

  log.debug(thisQueryUrl)
  var rq = request.get({url: thisQueryUrl,
    headers: {'User-Agent': config.userAgent}})
  var convertXML2JSON = function (data) {
    // console.log(data.body)
    parseString(data.body, function (err, datum) {
      if (err) throw err
      var cb = arxiv.completeCallback.bind(arxiv, datum)
      cb()
    })
  }
  rq.on('complete', convertXML2JSON)
  rq.on('timeout', arxiv.timeoutCallback)
}
function getIstexIdsFromOnePage() {
  	var url = urls.pop();
  	request.get({
    	url: url,
    	maxAttempts: 50,   // (default) try 50 times
    	retryDelay: 10000,  // (default) wait for 10s before trying again
    	retryStrategy: request.RetryStrategies.HTTPOrNetworkError // (default) retry on 5xx or network errors
  	}, 
  	function (err, res) {
    	if (err) {
      		console.error(err, url);
      		return;
    	}
    	var json = JSON.parse(res.body);
 		if (json && json.hits) {
      		json.hits.forEach(function (doc) {
	        	var jsonRes = {
	          		corpusName: doc.corpusName,
	          		istexId: doc.id,
var retryOnHTTPNetOrEuPMCFailure = function (err, response, body) {
    return requestretry.RetryStrategies.HTTPOrNetworkError(err, response, body) ||
            ~body.indexOf('') // hacky way to see if resultsList is empty
  }
MODE_OC,
} from './FeedUploaderConstants';
import {getLogger, getLoggerAWS} from './Logger';
import {getValidEvents} from './RequestDataBuilder';
import {
  UNSUPPORTED_MODE,
  ERROR_NO_CA_ID_OR_ACT_ID,
} from './ErrorTypes';

const querystring = require('querystring');
const request = require('requestretry');
const APIErrorTypes = require('./APIErrorTypes');

const MAX_RETRIES = 10;   // Retry 10 times.
const RETRY_DELAY = 5000; // Wait 5s before trying again.
const RETRY_STRATEGY = request.RetryStrategies.HTTPOrNetworkError; // retry on 5xx or network errors.

export const uploadEventsBatch = (
  events: Array,
  postData: string,
  uploadSessionTag: string,
  fileOffset: number,
  configs: FeedUploaderConfigs,
  callback: batchUploadCallbackType,
): void => {
  // Do the real uploading (calling into graph API) if not silent.
  if (configs.silent !== true) {
    getLogger().info(
      `Posting rows ${getBatchSigStr({offset: fileOffset, size: events.length})} to \
${datasetEndpoint(configs)}`
    );
    _postEvents(events, postData, fileOffset, configs, uploadSessionTag, callback);
// seperate pool for species requests as that API often has outages.
const speciesAgent = new Agent({
  maxSockets: 8000, // Default = Infinity
  maxFreeSockets: 256, // default
  keepAlive: true,
  keepAliveMsecs: 1000
});

let speciesRequest = request.defaults({
  agent: speciesAgent,
  headers: {
    'User-Agent': 'GBIF-portal Occurrence'
  },
  maxAttempts: 1,
  retryDelay: 3000, // in milliseconds
  retryStrategy: request.RetryStrategies.HTTPOrNetworkError, // (default) retry on 5xx or network errors
  timeout: 45000 // in milliseconds
});

module.exports = {
    standard: stdRequest,
    occurrence: occurrenceRequest,
    species: speciesRequest
};
retryStrategy: request.RetryStrategies.HTTPOrNetworkError // (default) retry on 5xx or network errors
    }

    if (parent.options[`${options.type}SocksProxy`]) {
      Object.assign(defaultOptions,
        elasticsearch.applyProxy(url, parent.options[`${options.type}SocksProxy`], parent.options[`${options.type}SocksPort`]))
    }

    if (this.parent.options.tlsAuth) {
      Object.assign(defaultOptions,
        this.applySSL([`${options.type}-cert`, `${options.type}-key`, `${options.type}-pass`, `${options.type}-ca`]))

      Object.assign(defaultOptions, this.applySSL(['cert', 'key', 'pass', 'ca']))
    }

    this.baseRequest = request.defaults(defaultOptions)
  }
'use strict';

const sprintf = require('sprintf')
const request = require('requestretry').defaults({ maxAttempts: 2, retryDelay: 1000 })
const parser = require('cheerio')
const utils = require('./utils')
const moment = require('moment-timezone')
const zone = "Asia/Hong_Kong" // +8h

const URL = 'http://www.sky56.cn/track/track/result?tracking_number=%s'

const sky = {}

/**
 * Get Sky56 info
 * Supports PQ... and NL... LVS.. SYB.. ids
 * Async
 *
 * @param id
 * @param callback(Error, SkyInfo)
const Q = require("q");
const async = require("async");

const ProductName = "IBM Watson Content Hub";
const ProductAbrev = "wchtools";
const ProductVersion = require("../../package.json").version;
const userAgent = ProductAbrev + "/" + ProductVersion;

const i18nModule = require("i18n-2");
const i18n = getI18N(__dirname, ".json", "en");
const vPath = new RegExp('[?<>*|"]');
const loggers = {};
let httplang;

// Enable the request module cookie jar so cookies can be shared across response, request with this request wrapper
const requestWrapper = require("requestretry").defaults({jar: true});

// Expose the default retry strategy for detecting retryable network errors.
const retryNetworkErrors = require("requestretry").RetryStrategies.NetworkError;

/**
 * Get the object that is used to localize strings.
 *
 * @param directory the directory that the search for the nls directory starts from, it looks up the tree for the nls directory
 * @param extension the extension of the file with localizations. Default to .json if not passed
 * @param defaultLocale the local to use as a default. en is used if not set
 *
 * @returns {Object}
 */
function getI18N (directory, extension, defaultLocale) {
    let dir = directory;
    while (dir && !fs.existsSync(dir + "/nls")) {
'use strict';

const request = require('requestretry').defaults({timeout: 10000, maxAttempts: 2, retryDelay: 500})
const parser = require('cheerio')
const utils = require('./utils')
const sprintf = require('sprintf')
const moment = require('moment-timezone')
const zone = "Europe/Madrid" // +1h

const URL = 'https://www.correosexpress.com/web/correosexpress/envios4?param=%s;%s'

const correos = {}

/**
 * Get correos info
 * Scraps the Correos Express website
 * Async
 *
 * Design changes may break this code!!

Is your System Free of Underlying Vulnerabilities?
Find Out Now