Tabnine Logo For Javascript
Request.auth
Code IndexAdd Tabnine to your IDE (free)

How to use
auth
function
in
Request

Best JavaScript code snippets using request.Request.auth(Showing top 15 results out of 315)

origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/ptz.cgi?action=' + action + '&channel=0&code=' + direction + '&arg1=' + speed +'&arg2=' + speed + '&arg3=0', function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'FAILED TO ISSUE PTZ UP COMMAND');
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/snapshot.cgi?' + options.channel , function (error, response, body) {
  if ((error) || (response.statusCode !== 200)) {
   self.emit("error", 'ERROR ON SNAPSHOT');
  } 
 })
 .on('end',function(){
  if(TRACE) console.log('SNAPSHOT SAVED');
  self.emit("getSnapshot", {
  'status':'DONE',});
 })
 .auth(USER,PASS,false).pipe(fs.createWriteStream(path.join(options.path,options.filename)));
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/mediaFileFind.cgi?action=factory.create', function (error, response, body) {
  if ((error)) {
   self.emit("error", 'ERROR ON CREATE FILE FIND COMMAND');
  }
  // stripping 'result=' and returning the object ID
  var oid = body.trim().substr(7);
  self.emit("fileFinderCreated",oid);

 }).auth(USER,PASS,false);
origin: redhat-developer-tooling/developer-platform-install

downloadAuth(options, username, password, file, sha, installer) {
  let stream = fs.createWriteStream(file);
  this.downloads.set(stream.path, {installer, options, username, password, sha, 'failure': false, currentSize : 0});
  this.root = this.root.then(() => {
   return new Promise((resolve)=>{
    request.get(this.setAdditionalOptions(options))
     .auth(username, password)
     .on('error', this.errorHandler.bind(this, stream))
     .on('error', resolve)
     .on('response', this.responseHandler.bind(this, installer))
     .on('data', this.dataHandler.bind(this, file))
     .on('end', this.endHandler.bind(this, stream))
     .pipe(stream)
     .on('close', this.closeHandler.bind(this, stream.path, sha, options))
     .on('close', resolve);
   });
  });
  return this.root;
 }
origin: paaland/node-jfs

function getFile(path) {
  var url = 'https://down.jottacloud.com/jfs/' + config.username + '/' + encodeURI(path) + '?mode=bin';
  var target = path.substring(path.lastIndexOf('/')+1).replace(/((\?|#).*)?$/,'');
  
  console.log('Downloading: ' + path);
  console.log('Saving to: ' + target);

  var options = {
    url: url,
    headers: {
      'User-Agent': 'node-jfs https://github.com/paaland/node-jfs'
    }
  };

  request
    .get(options)
    .auth(config.username, config.password, true)
    .on('error', function(err) {
      console.error(err)
    })
    .on('response', function(response) {
      console.log(response.statusCode) // 200
    })
    .pipe(fs.createWriteStream(target));
}
origin: nayrnet/node-dahua-api

// console.log(url);
 
 request(url, function (error, response, body) {
  if ((error)) {
   if (TRACE) console.log('startFileFind Error:',error);
   self.emit("error", 'FAILED TO ISSUE FIND FILE COMMAND');
  } else {
   if (TRACE) console.log('startFileFind Response:',body.trim());

   // no results = http code 400 ? 
   //if(response.statusCode == 400 ) {
   //  self.emit("error", 'FAILED TO ISSUE FIND FILE COMMAND - NO RESULTS ?');
   //} else {
   //
    self.emit('startFileFindDone',objectId,body.trim());
   //}
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/mediaFileFind.cgi?action=findNextFile&object=' + objectId + '&count=' + count, function (error, response, body) {
  if ((error) || (response.statusCode !== 200)) {
   if (TRACE) console.log('nextFileFind Error:',error);
   self.emit("error", 'FAILED NEXT FILE COMMAND');
  }
  
  // if (TRACE) console.log('nextFileFind Response:',body.trim());

  var items = {};
  var data = body.split('\r\n');
  
  // getting found count
  items.found = data[0].split("=")[1];

  // parsing items
  data.forEach(function(item){
   if(item.startsWith('items[')) {
    var propertyAndValue = item.split("=");
    setKeypath(items, propertyAndValue[0], propertyAndValue[1]);
   }
  });

  self.emit('nextFileFindDone',objectId,items);

 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1', function (error, response, body) {
  if ((!error) && (response.statusCode === 200)) {
   if (body === 'Error') {   // Didnt work, lets try another method for older cameras
    request(BASEURI + '/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=0', function (error, response, body) { 
     if ((error) || (response.statusCode !== 200)) {
      self.emit("error", 'FAILED TO CHANGE TO DAY PROFILE');
     }
    }).auth(USER,PASS,false);
   }
  } else {
   self.emit("error", 'FAILED TO CHANGE TO DAY PROFILE');
  } 
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/ptz.cgi?action=getStatus', function (error, response, body) {
  if ((!error) && (response.statusCode === 200)) {
   body = body.toString().split('\r\n');
   self.emit("ptzStatus", body);
  } else {
   self.emit("error", 'FAILED TO QUERY STATUS');
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/mediaFileFind.cgi?action=close&object=' + objectId, function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'ERROR ON CLOSE FILE FIND COMMAND');
  }
  
  self.emit('closeFileFindDone',objectId,body.trim());

 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=' + preset + '&arg3=0', function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'FAILED TO ISSUE PTZ PRESET');
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/ptz.cgi?action=start&channel=0&code=' + cmd + '&arg1=0&arg2=' + multiple + '&arg3=0', function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'FAILED TO ISSUE PTZ ZOOM');
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/mediaFileFind.cgi?action=destroy&object=' + objectId, function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'ERROR ON DESTROY FILE FIND COMMAND');
  }

  self.emit('destroyFileFindDone',objectId,body.trim());

 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/ptz.cgi?action=start&channel=0&code=' + ptzcommand + '&arg1=' + arg1 + '&arg2=' + arg2 + '&arg3=' + arg3 + '&arg4=' + arg4, function (error, response, body) {
  if ((error) || (response.statusCode !== 200) || (body.trim() !== "OK")) {
   self.emit("error", 'FAILED TO ISSUE PTZ COMMAND');
  }
 }).auth(USER,PASS,false);
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=2', function (error, response, body) {
  if ((!error) && (response.statusCode === 200)) {
   if (body === 'Error') {   // Didnt work, lets try another method for older cameras
    request(BASEURI + '/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[0].NightOptions.SwitchMode=3', function (error, response, body) { 
     if ((error) || (response.statusCode !== 200)) {
      self.emit("error", 'FAILED TO CHANGE TO NIGHT PROFILE');
     }
    }).auth(USER,PASS,false);
   }
  } else {
   self.emit("error", 'FAILED TO CHANGE TO NIGHT PROFILE');
  } 
 }).auth(USER,PASS,false);
request(npm)Requestauth

Most used request functions

  • request
  • Response.statusCode
  • RequestAPI.post
  • RequestAPI.get
  • Request.pipe
  • rp,
  • Request.on,
  • Response.headers,
  • RequestAPI.defaults,
  • RequestAPI.put,
  • RequestAPI.jar,
  • Response.statusMessage,
  • RequestAPI.head,
  • Response.on,
  • RequestAPI.cookie,
  • RequestAPI.delete,
  • Response.pipe,
  • RequestAPI.del,
  • requestRetry

Popular in JavaScript

  • js-yaml
    YAML 1.2 parser and serializer
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • mocha
    simple, flexible, fun test framework
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • debug
    small debugging utility
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now