Sample CLI
gway awg view-cable-finder
Signature
(*, meters=None, amps='40', volts='220', material='cu', max_lines='3', phases='1', conduit=None,
neutral='0', **kwargs)
Docstring
Page builder for AWG cable finder with HTML form and result.
TODOs
# TODO: Add a image with the sponsor logo on the right side of the result page
Sample CLI
gway cdv credit
Signature
(table_path: str, entry: str, *, field: str = 'balance', **kwargs) -> bool
Docstring
Add 1 (or amount from kwargs) to the given field for a record.
Signature
(table_path: str, entry: str, *, field: str = 'balance', **kwargs) -> bool
Docstring
Subtract 1 (or amount from kwargs) from the given field for a record.
Signature
(string, safe='/', encoding=None, errors=None)
Docstring
quote('abc def') -> 'abc%20def'
Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted. The
quote function offers a cautious (not minimal) way to quote a
string for most of these parts.
RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists
the following (un)reserved characters.
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Each of the reserved characters is reserved in some component of a URL,
but not necessarily in all of them.
The quote function %-escapes all characters that are neither in the
unreserved chars ("always safe") nor the additional chars set via the
safe arg.
The default for the safe arg is '/'. The character is reserved, but in
typical usage the quote function is being called on a path where the
existing slash characters are to be preserved.
Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings.
Now, "~" is included in the set of unreserved characters.
string and safe may be either str or bytes objects. encoding and errors
must not be specified if string is a bytes object.
The optional encoding and errors parameters specify how to deal with
non-ASCII characters, as accepted by the str.encode method.
By default, encoding='utf-8' (characters are encoded with UTF-8), and
errors='strict' (unsupported characters raise a UnicodeEncodeError).
Sample CLI
gway cdv unquote
Signature
(string, encoding='utf-8', errors='replace')
Docstring
Replace %xx escapes by their single-character equivalent. The optional
encoding and errors parameters specify how to decode percent-encoded
sequences into Unicode characters, as accepted by the bytes.decode()
method.
By default, percent-encoded sequences are decoded with UTF-8, and invalid
sequences are replaced by a placeholder character.
unquote('abc%20def') -> 'abc def'.
Sample CLI
gway cdv validate
Signature
(table_path: str, entry: str, *, validator=None) -> bool
Docstring
Validate a CDV entry by ID directly from file.
Always reloads the file from disk to avoid stale data.
Sample CLI
gway etron extract-records
Signature
(location, *, add_days=0, after=None, before=None, batch=None)
Docstring
Load data from EV IOCHARGER .json files to CSV format.
> gway etron extract_records san-pedro
> gway etron extract_records calzada-del-valle
> gway etron extract_records porsche-centre
This assumes the files are at work/etron/records/<location>.
Sample CLI
gway mail search
Signature
(subject_fragment, body_fragment=None)
Docstring
Search emails by subject and optionally body. Use "*" to match any subject.
Signature
(subject, body=None, to=None, threaded=None, **kwargs)
Docstring
Send an email with the specified subject and body, using defaults from env if available.
Parameters:
- subject: the email subject (string)
- body: the plain-text body (string). Must be provided.
- to: recipient address (string). Defaults to ADMIN_EMAIL from the environment.
- threaded: if True, send the email asynchronously; if False, block and send; if None, auto-detect.
- **kwargs: reserved for future use.
Returns:
str ("Email sent successfully to ...") or error message, unless threaded is True (returns immediately).
Sample CLI
gway mtg search
Signature
(query, *, show=True, limit=5, **kwargs)
Docstring
Search for Magic: The Gathering cards using Scryfall API.
Parameters:
query (str): The search query (name, text, type, etc.)
show (bool): If True, print the card(s) info; else, return the results.
**kwargs: Extra parameters for the Scryfall search API.
Returns:
list of dict: List of matching card data dicts if show=False.
None: If show=True (prints results directly).
Sample CLI
gway odoo create-quote
Signature
(*, customer, template_id, validity=None, notes=None)
Docstring
Create a new quotation using a specified template and customer name.
Parameters:
customer (str): The name (or partial name) of the customer to link to the quote.
template_id (int): The ID of the quotation template to use.
validity (str, optional): The expiration date for the quote in 'YYYY-MM-DD' format.
notes (str, optional): Internal notes or message to include in the quote.
Returns:
dict: The created quotation details.
Sample CLI
gway odoo execute-kw
Signature
(*args, model: str, method: str, **kwargs) -> dict
Docstring
A generic function to directly interface with Odoo's execute_kw method.
Parameters:
model (str): The Odoo model to interact with (e.g., 'sale.order').
method (str): The method to call on the model (e.g., 'read', 'write').
args (list): Positional arguments to pass to the method.
kwargs (dict): Keyword arguments to pass to the method.
Returns:
dict: The result of the execute_kw call.
Sample CLI
gway odoo fetch-customers
Signature
(*, name=None, email=None, phone=None, country=None, latest_quotes=None, **kwargs)
Docstring
Fetch customers from Odoo with optional filters.
Parameters:
name (str, optional): Filter customers by their name or part of it.
email (str, optional): Filter customers by their email address or part of it.
phone (str, optional): Filter customers by their phone number or part of it.
country (str, optional): Filter customers by their country name or part of it.
**kwargs: Additional filters to be applied, passed as key-value pairs.
Returns:
dict: The fetched customers.
TODOs
# TODO: If latest_quotes is a number, also fetch the many latest quotes for this customer.
Sample CLI
gway odoo fetch-order
Docstring
Fetch the details of a specific order by its ID from Odoo, including all line details.
Sample CLI
gway odoo fetch-quotes
Signature
(*, state='draft', older_than=None, salesperson=None, customer=None, **kwargs)
Docstring
Fetch quotes/quotations from Odoo with optional filters.
Parameters:
state (str): Filter quotations by their state. Default is 'draft'.
older_than (int, optional): Filter quotations older than a specific number of days.
salesperson (str, optional): Filter quotations by the salesperson's name or part of it.
customer (str, optional): Filter quotations by the customer's name or part of it.
kwargs (list, optional): Additional domain filters for the query.
Returns:
dict: The fetched quotations.
Sample CLI
gway odoo fetch-templates
Signature
(*, name=None, active=True, **kwargs)
Docstring
Fetch available quotation templates from Odoo with optional filters.
Parameters:
name (str, optional): Filter templates by name or part of it.
active (bool): Whether to include only active templates. Defaults to True.
**kwargs: Additional filters as key-value pairs.
Returns:
dict: The fetched quotation templates.
Sample CLI
gway odoo find-quotes
Signature
(*, product, quantity: int = 1, state: str = 'draft', **kwargs)
Docstring
Find all sale quotes that contain a given product (by id or name substring) with at least the given quantity.
Parameters:
product (str or int): Product ID or partial name.
quantity (int): Minimum quantity of the product in the quote. Default is 1.
state (str): Odoo sale order state (default: 'draft' for quotations).
**kwargs: Additional domain filters for sale.order.
Returns:
list: List of matching sale orders (quotes) with product line details.
Sample CLI
gway odoo get-user-info
Signature
(*, username: str) -> dict
Docstring
Retrieve Odoo user information by username.
Sample CLI
gway odoo setup-chatbot-app
Signature
(*, path='/chatbot', username='[ODOO_USERNAME]', alias='Operator', apps=None)
Docstring
Create a FastAPI app (or append to existing ones) serving a chatbot UI and logic.
Sample CLI
gway release build
Signature
(*, bump: bool = False, dist: bool = False, twine: bool = False, help_db: bool = True, projects:
bool = False, git: bool = False, all: bool = False, force: bool = False) -> None
Docstring
Build the project and optionally upload to PyPI.
Args:
bump (bool): Increment patch version if True.
dist (bool): Build distribution package if True.
twine (bool): Upload to PyPI if True.
force (bool): Skip version-exists check on PyPI if True.
git (bool): Require a clean git repo and commit/push after release if True.
vscode (bool): Build the vscode extension.
Sample CLI
gway release changes
Signature
(*, files=None, staged=False, context=3, max_bytes=200000, clip=False)
Docstring
Returns a unified diff of all recent textual changes in the git repo.
- Shows added/removed lines (ignores binary files).
- Includes unstaged (working directory) by default. Use staged=True to see only staged.
- 'files': Optionally filter by path(s) or file glob(s).
- 'context': Number of context lines in the diff (default 3).
- 'max_bytes': Truncate diff if too large (default 200,000).
Sample CLI
gway screen lookup-font
Docstring
Look up fonts installed on a Windows system by partial name (prefix).
>> gway font lookup Ari
Sample CLI
gway screen notify
Signature
(message, *, title='GWAY Notice', timeout: int = 10)
Docstring
Show a user interface notification with the specified title and message.
Falls back to a visible console printout if GUI notification fails.
Sample CLI
gway sql execute
Signature
(*sql, connection=None, script=None, sep='; ', args=None)
Docstring
Thread-safe SQL execution.
- SELECTs and other read queries run immediately (parallel safe).
- DML/DDL statements (INSERT/UPDATE/DELETE/etc) are funneled into the write queue.
- Multi-statement scripts are supported via executescript.
- All write queue items are always 5-tuple: (sql, args, conn, result_q, is_script)
Sample CLI
gway vbox open-remote
Signature
(server_url: str = '[SERVER_URL]', *, path: str = 'vbox', email: str = '[ADMIN_EMAIL]')
Docstring
Create a vbox on a remote system, retrieve the upload link from email, and store it locally.
- server_url: Base URL of the remote server (e.g., 'https://example.com')
- path: Path on remote server where vbox upload is handled (default 'vbox')
- email: Email address to receive the upload link (should be accessible by local mail.search)
Returns: dict of stored record fields, or None if unsuccessful.
Sample CLI
gway vbox poll-remote
Signature
(server_url: str = '[SERVER_URL]', *, target='work/vbox/remote', interval=3600)
Docstring
Poll the remote vbox for files and download new/updated ones to the local target directory.
- server_url: Remote GWAY instance base URL
- target: Local directory to save downloaded files
- interval: Seconds between polls (runs forever unless interval=None)
Skips files already downloaded by using the modified_since parameter.
Sample CLI
gway vbox purge
Docstring
Manually purge expired vbox entries and remove their folders.
Args:
all (bool): If True, delete all folders, even non-empty ones and those not in _open_boxes.
Sample CLI
gway vbox render-error
Signature
(title: str, message: str, *, back_link: bool = True, target: str = 'uploads') -> str
Docstring
Helper for error display with optional link back to upload main page.
Sample CLI
gway vbox view-downloads
Signature
(*hashes: tuple[str], vbid: str = None, modified_since=None, **kwargs)
Docstring
GET: Show list of files in the box (with hash), allow selection/downloads.
If a single hash is provided, return that file. Multiple hashes are not supported yet.
- Allows access via full vbid (short.long) or short-only (just the folder name).
- If full vbid is used, shows link to upload more files.
- If modified_since is passed (as iso or epoch seconds), only send file if newer, else 304.
TODOs
# TODO: Support multiple hashes by checking them one by one. If the first doesn't exist,
# try the next and so forth. Give up when every hash fails to match. First matches is chosen first.
Sample CLI
gway vbox view-uploads
References
build_url,
error,
exception,
info,
mail,
mail.send,
resource,
warning,
web,
web.app,
web.app.build_url,
web.server,
web.server.is_local Signature
(*, vbid: str = None, timeout: int = 60, files: int = 4, email: str = None, **kwargs)
Docstring
GET: Display upload interface or create a new upload box.
POST: Handle uploaded files to a specific vbid.
Sample CLI
gway ocpp.csms is-abnormal-status
Signature
(status: str, error_code: str) -> bool
Docstring
Determine if a status/errorCode is 'abnormal' per OCPP 1.6.
Sample CLI
gway ocpp.csms setup-app
References
cdv,
cdv.validate,
debug,
error,
exception,
info,
mail,
mail.send,
resolve,
resource,
unwrap_one,
warn Signature
(*, app=None, allowlist=None, denylist=None, location=None, authorize=<function authorize_balance at
0x00000256F2C3F1A0>, email=None)
Sample CLI
gway ocpp.csms view-charger-status
Signature
(*, action=None, charger_id=None, **_)
Docstring
Card-based OCPP dashboard: summary of all charger connections.
Sample CLI
gway ocpp.sink setup-sink-app
Docstring
Basic OCPP passive sink for messages, acting as a dummy CSMS server.
This won't pass compliance or provide authentication. It just accepts and logs all.
Note: This version of the app was tested at the EVCS with real EVs.
Sample CLI
gway web.app setup
References
abort,
context,
debug,
info,
resource,
to_html,
to_json,
unwrap_one,
verbose,
version,
web,
web.auth,
web.auth.is_authorized,
web.error,
web.error.redirect,
web.error.unauthorized Signature
(*, app=None, project='web.site', path=None, home: str = None, views: str = 'view', apis: str =
'api', static='static', shared='shared', css='global', js='global', auth_required=False,
engine='bottle')
Docstring
Setup Bottle web application with symmetrical static/shared public folders.
Only one project per app. CSS/JS params are used as the only static includes.
Sample CLI
gway web.app urlencode
Signature
(query, doseq=False, safe='', encoding=None, errors=None, quote_via=<function quote_plus at
0x00000256EF81D940>)
Docstring
Encode a dict or sequence of two-element tuples into a URL query string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the order of the
parameters in the output will match the order of parameters in the
input.
The components of a query arg may each be either a string or a bytes type.
The safe, encoding, and errors parameters are passed down to the function
specified by quote_via (encoding and errors only if a component is a str).
Sample CLI
gway web.error redirect
Signature
(message='', *, err=None, default=None, view_name=None)
Docstring
GWAY error/redirect handler.
Deprecated: 'view_name'. Now uses gw.web.app.current_endpoint.
Sample CLI
gway web.error unauthorized
Signature
(message='Unauthorized: You do not have access to this resource.', *, err=None, default=None)
Docstring
If in debug mode: show detailed error.
If not in debug: return a 401 Unauthorized and a WWW-Authenticate header to trigger the browser auth dialog.
Sample CLI
gway web.error view-debug-error
Signature
(*, title='GWAY Debug Error', message='An error occurred.', err=None, status=500, default=None)
Docstring
Render a debug error view with detailed traceback and request info.
Sample CLI
gway web.proxy setup-fallback-app
Signature
(*, endpoint: str, app=None, websockets: bool = False, path: str = '/', mode: str = 'extend',
callback=None)
Docstring
Create an HTTP (and optional WebSocket) fallback to the given endpoint.
This asumes the given endpoint will replicate or provide missing functionality
or the entire service if it can't be provided locally.
TODOs
# TODO: Implement a mode kwarg that defaults to "extend" and functions like this:
# replace: Replace all paths in the received apps with the proxied endpoint.
# extend: Redirect all paths not already configured to the proxy.
# errors: Catch errors thrown by the app and redirect the failed calls to the proxy.
# trigger: Use a callback function to check. Redirects when result is True.
# Move this explanation to the docstring.
# TODO: We need to use gw.unwrap_all instead and apply the proxy mode to each of the
# apps found there, then we need to return all those apps in a collection.
# collect apps by type
# TODO: Test that this return is properly compatible with web.server.start_app after the fixes
Sample CLI
gway web.server is-local
Signature
(request=None, host=None)
Docstring
Returns True if the active HTTP request originates from the same machine
that the server is running on (i.e., local request). Supports both
Bottle and FastAPI (ASGI/WSGI).
Args:
request: Optionally, the request object (Bottle, Starlette, or FastAPI Request).
host: Optionally, the bound host (for override or testing).
Returns:
bool: True if request is from localhost, else False.
Sample CLI
gway web.site publish-parts
Signature
(source, source_path=None, source_class=<class 'docutils.io.StringInput'>, destination_path=None,
reader=None, reader_name='standalone', parser=None, parser_name='restructuredtext', writer=None,
writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None,
config_section=None, enable_exit_status=False)
Docstring
Set up & run a `Publisher`, and return a dictionary of document parts.
Dictionary keys are the names of parts.
Dictionary values are `str` instances; encoding is up to the client,
e.g.::
parts = publish_parts(...)
body = parts['body'].encode(parts['encoding'], parts['errors'])
See the `API documentation`__ for details on the provided parts.
Parameters: see `publish_programmatically()`.
__ https://docutils.sourceforge.io/docs/api/publisher.html#publish-parts
Signature
(message: str, *, exit_code: int = 1) -> int
Docstring
Abort with error message.
Sample CLI
gway run-recipe
Signature
(*script: str, **context)
Docstring
Run commands parsed from a .gwr file, falling back to the 'recipes/' resource bundle.
Recipes are gway scripts composed of one command per line with optional comments.