banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Examples

banshee/examples-collection/examples/protocols/

http-get-account

Example: http.get with user= and password=, an optional account in Basic.

  • example
  • protocol
  • http
  • account
  • basic

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

Keen 1.0.0 · 19 lines
// http.get with an account: user= and password= send it in Basic. Here the account is optional: an empty
// user sends none, so the same line serves a page with or without an account.
need('protocol:http');
$user = need('protocol:http:user', 'optional');
$password = need('protocol:http:password', 'optional');

$url = variable('example:page:url', 'text', array(
    'label' => 'Address of the page',
    'help'  => 'For example https://intranet.example/.',
));

output('status', 'number', array('label' => 'Answer code'));

watch.expect('refused', 'Page refused', 'status', array('critical' => array(200)));

// The password is a secret: it goes only into the call, never into a value or a message, and never
// over http://.
$answer = http.get($url, user=$user, password=$password);
value('status', $answer['status']);