# core


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L17"
target="_blank" style="float:right; font-size:smaller">source</a>

### caplogin

>  caplogin (server_url:str, server_password:str)

*Login to CapRover and return authentication token*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td>CapRover server URL (e.g., https://captain.domain.com/)</td>
</tr>
<tr>
<td>server_password</td>
<td>str</td>
<td>CapRover dashboard password</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>str</strong></td>
<td><strong>Authentication token</strong></td>
</tr>
</tbody>
</table>

``` python
token = caplogin(capsrv, cappass)
token[:2]
```

    'ey'

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L77"
target="_blank" style="float:right; font-size:smaller">source</a>

### setup_app

>  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)*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app to create and configure</td>
</tr>
<tr>
<td>volumes</td>
<td>dict</td>
<td>None</td>
<td>Dict of {volumeName: containerPath} for persistent storage</td>
</tr>
<tr>
<td>env_vars</td>
<td>dict</td>
<td>None</td>
<td>Dict of {name: value} for environment variables</td>
</tr>
<tr>
<td>instance_count</td>
<td>int</td>
<td>1</td>
<td>Number of container instances</td>
</tr>
<tr>
<td>force_ssl</td>
<td>bool</td>
<td>True</td>
<td>Force HTTPS redirect</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L63"
target="_blank" style="float:right; font-size:smaller">source</a>

### enable_ssl

>  enable_ssl (server_url:str, token:str, app_name:str, timeout:int=120)

*Enable HTTPS/SSL for an app’s base domain*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app</td>
</tr>
<tr>
<td>timeout</td>
<td>int</td>
<td>120</td>
<td>Request timeout in seconds (SSL generation can be slow)</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L43"
target="_blank" style="float:right; font-size:smaller">source</a>

### update_app

>  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)*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app to update</td>
</tr>
<tr>
<td>volumes</td>
<td>dict</td>
<td>None</td>
<td>Dict of {volumeName: containerPath} for persistent storage</td>
</tr>
<tr>
<td>env_vars</td>
<td>dict</td>
<td>None</td>
<td>Dict of {name: value} for environment variables</td>
</tr>
<tr>
<td>instance_count</td>
<td>int</td>
<td>1</td>
<td>Number of container instances</td>
</tr>
<tr>
<td>force_ssl</td>
<td>bool</td>
<td>None</td>
<td>Force HTTPS redirect</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L29"
target="_blank" style="float:right; font-size:smaller">source</a>

### create_app

>  create_app (server_url:str, token:str, app_name:str,
>                  persistent:bool=False)

*Register a new app on CapRover*

<table>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app to create</td>
</tr>
<tr>
<td>persistent</td>
<td>bool</td>
<td>False</td>
<td>Whether app needs persistent storage</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

``` python
app_name = "mynewapp"
volumes = {"testapi-data": "/app/data"}
env_vars = {"MY_SECRET": "supersecret123"}

setup_app(capsrv, token, app_name, volumes=volumes, env_vars=env_vars)
```

    {'status': 100, 'description': 'Updated App Definition Saved', 'data': {}}

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L109"
target="_blank" style="float:right; font-size:smaller">source</a>

### deploy

>  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)*

<table>
<colgroup>
<col style="width: 6%" />
<col style="width: 25%" />
<col style="width: 34%" />
<col style="width: 34%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app to deploy to</td>
</tr>
<tr>
<td>script_paths</td>
<td>str | list</td>
<td></td>
<td>Path(s) to Python script(s). First script is the entry point</td>
</tr>
<tr>
<td>requirements</td>
<td>list</td>
<td>None</td>
<td>List of pip requirements. Defaults to [“python-fasthtml”]</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L94"
target="_blank" style="float:right; font-size:smaller">source</a>

### upload_app

>  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*

<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 38%" />
<col style="width: 52%" />
</colgroup>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td>Name of the app to deploy to</td>
</tr>
<tr>
<td>tar_buffer</td>
<td>BytesIO</td>
<td>In-memory tar.gz file containing deployment files</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

``` python
example_app = """from fasthtml.common import *

app = FastHTML()

@app.route("/")
def home(): return Div(H1("Hello World!"), P("Deployed with CapRover API"))

serve()
"""

Path("example_app.py").write_text(example_app)

deploy(capsrv, token, app_name, "example_app.py", requirements=["python-fasthtml"])
```

    {'status': 100, 'description': 'Deploy is done', 'data': {}}

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L151"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_app_deployment_logs

>  get_app_deployment_logs (server_url:str, token:str, app_name:str)

*Get build and deployment logs from an app*

<table>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td>Name of the app</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>str</strong></td>
<td><strong>Build/deployment logs</strong></td>
</tr>
</tbody>
</table>

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L138"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_app_logs

>  get_app_logs (server_url:str, token:str, app_name:str,
>                    encoding:str='ascii')

*Get runtime logs from a running app*

<table>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Default</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td></td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td></td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td></td>
<td>Name of the app</td>
</tr>
<tr>
<td>encoding</td>
<td>str</td>
<td>ascii</td>
<td>Log encoding</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>str</strong></td>
<td></td>
<td><strong>Runtime logs</strong></td>
</tr>
</tbody>
</table>

``` python
print(get_app_logs(capsrv, token, app_name))
```

          _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

------------------------------------------------------------------------

<a
href="https://github.com/tchambon/quickcap/blob/main/quickcap/core.py#L164"
target="_blank" style="float:right; font-size:smaller">source</a>

### delete_app

>  delete_app (server_url:str, token:str, app_name:str)

*Delete an app from CapRover*

<table>
<thead>
<tr>
<th></th>
<th><strong>Type</strong></th>
<th><strong>Details</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>server_url</td>
<td>str</td>
<td>CapRover server URL</td>
</tr>
<tr>
<td>token</td>
<td>str</td>
<td>Authentication token from caplogin</td>
</tr>
<tr>
<td>app_name</td>
<td>str</td>
<td>Name of the app to delete</td>
</tr>
<tr>
<td><strong>Returns</strong></td>
<td><strong>dict</strong></td>
<td><strong>API response</strong></td>
</tr>
</tbody>
</table>

``` python
delete_app(capsrv, token, app_name)
```

    {'status': 100, 'description': 'App is deleted', 'data': {}}
