Extended Libraries

Extended libraries provide Python-compatible functionality and require explicit registration by the host application.

See the Go Integration documentation for registering libraries.

Setup

import (
    "github.com/paularlott/scriptling/extlibs"
)

// Register libraries as needed
p.RegisterLibrary("requests", extlibs.RequestsLibrary)
p.RegisterLibrary("html.parser", extlibs.HTMLParserLibrary)

p.RegisterLibrary("yaml", extlibs.YAMllibrary)
p.RegisterLibrary("toml", extlibs.TomlLibrary)
p.RegisterLibrary("glob", extlibs.GlobLibrary)
p.RegisterLibrary("logging", extlibs.LoggingLibrary)
p.RegisterLibrary("os", extlibs.OSLibrary)
p.RegisterLibrary("secrets", extlibs.SecretsLibrary)

// Register os/pathlib with security restrictions
extlibs.RegisterOSLibrary(p, []string{"/tmp", "/data"})
extlibs.RegisterPathlibLibrary(p, []string{"/tmp", "/data"})
extlibs.RegisterWaitForLibrary(p)
extlibs.RegisterKVLibrary(p)
p.RegisterLibrary("subprocess", extlibs.SubprocessLibrary)
p.RegisterLibrary("sys", extlibs.SysLibrary)

HTTP & Networking

Library Description
requests HTTP library for sending requests

Parsing & Data

Library Description
glob Unix shell-style wildcards
html.parser HTML/XHTML parser
yaml YAML parsing and generation
toml TOML parsing and generation

System & Files

Library Description
os Operating system interfaces
os.path Pathname manipulations
pathlib Object-oriented filesystem paths
sys System-specific parameters
subprocess Spawn and manage subprocesses

Security

Library Description
secrets Cryptographically strong random numbers

Logging

Library Description
logging Logging functionality