Signature
(table_path: str, old_entry: str, new_entry: str, **kwargs) -> bool
Docstring
Copy a record from old_entry to new_entry, optionally updating fields.
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
(table_path: str, old_entry: str, new_entry: str, **kwargs) -> bool
Docstring
Move a record from old_entry to new_entry, optionally updating fields.
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.
Signature
(value=None, *, notify=True, when=None)
Docstring
Extracts or updates the clipboard contents.
Args:
value (str, optional): The value to copy to clipboard. If None, only reads the clipboard.
notify (bool, optional): Whether to send a GUI notification. Default is True.
when (str | Pattern, optional): If provided, must match clipboard contents.
Acts as a gatekeeper: if there's no match, returns None and skips updating.
Returns:
str | None: The previous clipboard content, or None if `when` did not match.
Sample CLI
gway clip track-history
Signature
(interval: int = 5, *, stop_after=None, notify=True)
Docstring
Tracks clipboard history by polling at regular intervals.
Args:
interval (int): Seconds to wait between checks. Default is 5 seconds.
stop_after (int | None): Optional maximum duration (in seconds) before stopping.
notify (bool): Whether to show GUI notifications for new entries.
Writes:
Appends new clipboard entries to 'work/clip/history.txt', separated by '
...
'.
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.
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 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 build-help-db
Sample CLI
gway sql close-connection
Signature
(datafile=None, *, sql_engine='sqlite', all=False)
Docstring
Explicitly close one or all cached database connections.
Shuts down writer thread if all connections closed.
Sample CLI
gway sql load-csv
Signature
(*, connection=None, folder='data', force=False)
Docstring
Recursively loads CSVs from a folder into SQLite tables.
Table names are derived from folder/file paths.
Sample CLI
gway sql open-connection
Signature
(datafile=None, *, sql_engine='sqlite', autoload=False, force=False, row_factory=False, **dbopts)
Docstring
Initialize or reuse a database connection.
Caches connections by sql_engine, file path, and thread ID (if required).
Starts writer thread for SQLite.
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 dispatch-action
Signature
(charger_id: str, action: str)
Docstring
Dispatch a remote admin action to the charger over OCPP via websocket.
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.evcs simulate-cp
Signature
(cp_idx, host, ws_port, rfid, cp_path, duration, session_count)
Docstring
Simulate a single CP session (possibly many times if session_count>1).
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.cookies view-my-mask
Signature
(*, claim=None, set_mask=None)
Docstring
View and manage mask linking for cookies.
- GET: Shows current mask and allows claim or update.
- POST (claim/set_mask): Claim a mask and save/load cookies to/from masks.cdv.
If user claims an existing mask AND already has a mask cookie,
ALL existing cookies (except cookies_accepted) are wiped before restoring the claimed mask.
No wipe is performed when creating a new mask.
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.server start-app
Signature
(*, host='[WEBSITE_HOST|127.0.0.1]', port='[WEBSITE_PORT|8888]', ws_port='[WEBSOCKET_PORT|9000]',
debug=False, proxy=None, app=None, daemon=True, threaded=True, is_worker=False, workers=None)
Docstring
Start an HTTP (WSGI) or ASGI server to host the given application.
- If `app` is a FastAPI instance, runs with Uvicorn (optionally on ws_port if set).
- If `app` is a WSGI app, uses Paste+ws4py or Bottle.
- If `app` is a zero-arg factory, it will be invoked (supporting sync or async factories).
- If `app` is a list of apps, each will be run in its own thread (each on an incremented port; FastAPI uses ws_port if set).
Docstring
Launch an interactive Python shell with 'from gway import gw' preloaded.