@Daniele This is an example for a node.js script that I use to pull back sensor data.
const https = require('https');
https.get({
host: 'localhost' // host of your mycontroller install
,port: 443 // this is 443 since it's SSL
,path: '/mc/rest/sensors/264' // example getting sensor info for sensor 264
,headers: {
'Authorization': 'Basic ' + new Buffer('USERNAME:PASSWORD').toString('base64')
}
}, (resp) => {
let data = '';
//console.log(resp);
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(JSON.parse(data).variables[0]);
});
}).on("error", (err) => {
console.log("Error: " + err.message);
});
Important thing to note is the Basic Auth header. This is how you send username and password.
The first google result I found for sending basic auth params in a python script
https://stackoverflow.com/questions/6999565/python-https-get-with-basic-authentication
import requests
r = requests.get('https://my.website.com/rest/path', auth=('myusername', 'mybasicpass'))
print(r.text)