from requests.auth import HTTPBasicAuth
requests.get('url', auth=HTTPBasicAuth('user', 'pass'))
var username = 'Test';
var password = '123';
var auth = 'Basic ' + Buffer.from(username + ':' + password).toString('base64');
// new Buffer() is deprecated from v6
// auth is: 'Basic VGVzdDoxMjM='
var header = {'Host': 'url', 'Authorization': auth};
var request = client.request('GET', '/', header);