Options

ExecuteScriptOptions

class ExecuteScriptOptions

The BareScript runtime options dict

debug: bool, optional

If true, execute in debug mode

fetchFn: callable, optional

The fetch function

globals: dict, optional

The global variables

logFn: callable, optional

The log function

maxStatements: int, optional = 1e9

The maximum number of statements; 0 for no maximum

statementCount: int, optional = 0

The current statement count

urlFn: callable, optional

The URL modifier function

systemPrefix: str, optional

The system include prefix

Fetch Functions

fetch_fn(request)

The fetch function interface

Parameters:

request – The request model

Returns:

The response text

Return type:

str

bare_script.fetch_http(request)

A fetch function implementation that fetches resources using HTTP GET and POST

bare_script.fetch_read_only(request)

A fetch function implementation that fetches resources that uses HTTP GET and POST for URLs, otherwise read-only file system access

bare_script.fetch_read_write(request)

A fetch function implementation that fetches resources that uses HTTP GET and POST for URLs, otherwise read-write file system access

Log Functions

log_fn(text)

The log function interface

Parameters:

text (str) – The log text

bare_script.log_stdout(text)

A log function implementation that outputs to stdout

URL Functions

url_fn(url)

The URL function interface

Parameters:

url (str) – The URL

Returns:

The modified URL

Return type:

str

bare_script.url_file_relative(file_, url)

A URL function implementation that fixes up file-relative paths

Parameters:
  • file – The URL or OS path to which relative URLs are relative

  • url – The URL or POSIX path to resolve

Returns:

The resolved URL