How to use the httpreq.post function in httpreq

To help you get started, we’ve selected a few httpreq 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 SteveMcGrath / DoFler / lib / parsers / pvs.js View on Github external
if (count <= 5) {
										cooked.push({
											name: vuln,
											pluginId: raw[vuln]['id'],
											count: raw[vuln]['data'][0],
											severity: raw[vuln]['severity']
										});
									}
								}
								web.vulnCache(cooked);
								console.log('PVS: Updated Top Vulnerabilities Cache');
								web.io.emit('topVulns', cooked);

								// Initiate a logout from the API.  We need to make sure to do
								// this so that we don't keep sessions running to time out
								httpreq.post(host + '/logout', {parameters: {json: 1, token: token}})
							}
						})
					}
github SteveMcGrath / DoFler / lib / parsers / pvs.js View on Github external
function pvsData() {
		var token = null;
		// Initiate the login to the PVS API.
		httpreq.post(host + '/login', {
			parameters: {
				login: config.Monitoring.PVS.username,
				password: config.Monitoring.PVS.password,
				json: 1
			}
		}, function(err, res) {
			if (err) {
				console.log('PVS: ' + err);
			} else {
				// As it appears that we were able to login, lets to ahead
				// and set the token variable.
				var data = JSON.parse(res.body);
				token = data['reply']['contents']['token'];

				// Here what we'll be interfacing to is the top hosts
				// dashboard item.  Since the New PVS WebUI has formatted
github SteveMcGrath / DoFler / lib / parsers / driftnet.js View on Github external
}).spread(function(image, created) {
										if (created && config.Monitoring.Driftnet.nsfw_filter) {
											httpreq.post(config.NSFW.address + '/score', {
												parameters: {
													path: 'file:///images/' + image.filename
												}
											}, function(err, res) {
												if (err) {
													console.log('Driftnet: ' + err);
												} else {
													if (res.statusCode == 200){
														data = JSON.parse(res.body)
														if (!data['error']){
															image.updateAttributes({
																nsfw: data['score']
															}).then(function(result) {
																console.log('Driftnet: ' + image.filename + ' created from ' + image.url + ' with nsfw score of ' + image.nsfw)
																io.emit('images', image)
															})
github SteveMcGrath / DoFler / lib / parsers / ngrep.js View on Github external
}).spread(function(image, created){
													if (created && config.Monitoring.NGrep.nsfw_filter) {
														httpreq.post(config.NSFW.address + '/score', {
															parameters: {
																path: 'file:///images/' + filename
															}
														}, function(err, res) {
															if (err) {
																console.log('NGrep: ' + err);
															} else {
																if (res.statusCode == 200){
																	data = JSON.parse(res.body)
																	if (!data['error']){
																		image.updateAttributes({
																			nsfw: data['score']
																		}).then(function(result) {
																			console.log('NGrep: ' + image.filename + ' created from ' + image.url + ' with nsfw score of ' + image.nsfw)
																			io.emit('images', image)
																		})
github casperboone / homey-samsung-smart-tv / samsung-tv-soap-api.js View on Github external
function apiCall(url, soapAction, callback, alternativeBody) {
    let body = '';
    if (alternativeBody) {
        body = alternativeBody;
    }

    httpreq.post(url, {
        headers: {
            'soapaction': '"urn:samsung.com:service:MainTVAgent2:1#' + soapAction + '"',
            'user-agent': "DLNADOC/1.50 SEC_HHP_Homey/1.0"
        },
        body: body
    }, (err, res) => {
        if (err) {
            Homey.log(err);
            typeof callback === 'function' && callback(err, res);
            return;
        }
        xml2js.parseString(res.body, function (err, result) {
            if (err) {
                Homey.log(err);
            }
            typeof callback === 'function' && callback(err, result);

httpreq

node-httpreq is a node.js library to do HTTP(S) requests the easy way

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis

Popular httpreq functions

Similar packages