token = caplogin(capsrv, cappass)
token[:2]'ey'
caplogin (server_url:str, server_password:str)
Login to CapRover and return authentication token
| Type | Details | |
|---|---|---|
| server_url | str | CapRover server URL (e.g., https://captain.domain.com/) |
| server_password | str | CapRover dashboard password |
| Returns | str | Authentication token |
setup_app (server_url:str, token:str, app_name:str, volumes:dict=None, env_vars:dict=None, instance_count:int=1, force_ssl:bool=True)
Create a new app with SSL enabled and configured settings (combines create_app, enable_ssl, update_app)
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app to create and configure | |
| volumes | dict | None | Dict of {volumeName: containerPath} for persistent storage |
| env_vars | dict | None | Dict of {name: value} for environment variables |
| instance_count | int | 1 | Number of container instances |
| force_ssl | bool | True | Force HTTPS redirect |
| Returns | dict | API response |
enable_ssl (server_url:str, token:str, app_name:str, timeout:int=120)
Enable HTTPS/SSL for an app’s base domain
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app | |
| timeout | int | 120 | Request timeout in seconds (SSL generation can be slow) |
| Returns | dict | API response |
update_app (server_url:str, token:str, app_name:str, volumes:dict=None, env_vars:dict=None, instance_count:int=1, force_ssl:bool=None)
Update app configuration (volumes, env vars, SSL settings)
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app to update | |
| volumes | dict | None | Dict of {volumeName: containerPath} for persistent storage |
| env_vars | dict | None | Dict of {name: value} for environment variables |
| instance_count | int | 1 | Number of container instances |
| force_ssl | bool | None | Force HTTPS redirect |
| Returns | dict | API response |
create_app (server_url:str, token:str, app_name:str, persistent:bool=False)
Register a new app on CapRover
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app to create | |
| persistent | bool | False | Whether app needs persistent storage |
| Returns | dict | API response |
{'status': 100, 'description': 'Updated App Definition Saved', 'data': {}}
deploy (server_url:str, token:str, app_name:str, script_paths:str|list, requirements:list=None)
Build and deploy a FastHTML app from Python script(s)
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app to deploy to | |
| script_paths | str | list | Path(s) to Python script(s). First script is the entry point | |
| requirements | list | None | List of pip requirements. Defaults to [“python-fasthtml”] |
| Returns | dict | API response |
upload_app (server_url:str, token:str, app_name:str, tar_buffer:_io.BytesIO)
Upload and deploy a tar.gz archive to an existing app
| Type | Details | |
|---|---|---|
| server_url | str | CapRover server URL |
| token | str | Authentication token from caplogin |
| app_name | str | Name of the app to deploy to |
| tar_buffer | BytesIO | In-memory tar.gz file containing deployment files |
| Returns | dict | API response |
{'status': 100, 'description': 'Deploy is done', 'data': {}}
get_app_deployment_logs (server_url:str, token:str, app_name:str)
Get build and deployment logs from an app
| Type | Details | |
|---|---|---|
| server_url | str | CapRover server URL |
| token | str | Authentication token from caplogin |
| app_name | str | Name of the app |
| Returns | str | Build/deployment logs |
get_app_logs (server_url:str, token:str, app_name:str, encoding:str='ascii')
Get runtime logs from a running app
| Type | Default | Details | |
|---|---|---|---|
| server_url | str | CapRover server URL | |
| token | str | Authentication token from caplogin | |
| app_name | str | Name of the app | |
| encoding | str | ascii | Log encoding |
| Returns | str | Runtime logs |
_2025-11-28T15:28:57.924022039Z INFO: Will watch for changes in these directories: ['/app']
e2025-11-28T15:28:57.924112883Z INFO: Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
W2025-11-28T15:28:57.924220463Z INFO: Started reloader process [1] using WatchFiles
92025-11-28T15:28:57.930583787Z Link: http://localhost:80
D2025-11-28T15:28:58.335346643Z INFO: Started server process [8]
J2025-11-28T15:28:58.335400954Z INFO: Waiting for application startup.
G2025-11-28T15:28:58.335540687Z INFO: Application startup complete.
R2025-11-28T15:28:59.626909551Z INFO: 10.0.1.5:39278 - "GET / HTTP/1.0" 200 OK
R2025-11-28T15:29:06.519078194Z INFO: 10.0.1.5:56198 - "GET / HTTP/1.0" 200 OK
d2025-11-28T15:29:06.695898424Z INFO: 10.0.1.5:56214 - "GET /favicon.ico HTTP/1.0" 404 Not Found
delete_app (server_url:str, token:str, app_name:str)
Delete an app from CapRover
| Type | Details | |
|---|---|---|
| server_url | str | CapRover server URL |
| token | str | Authentication token from caplogin |
| app_name | str | Name of the app to delete |
| Returns | dict | API response |