> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Anwendungen verwalten

> In diesem Abschnitt lernst du, wie du deine Anwendung mit der verfügbaren Bibliothek verwaltest. Du kannst auf verschiedene Weise mit deiner Anwendung interagieren, etwa Informationen über den Anwendungsstatus abrufen, auf Logs zugreifen, die Anwendung starten, stoppen und neu starten sowie die zugehörigen Dateien verwalten.

[Client]: client

[Application]: client#application

Alle folgenden Operationen können entweder über die [Client]-Klasse, die
[Application]-Klasse oder die CLI ausgeführt werden. Nachfolgend findest du Beispiele, wie du jede
dieser Aufgaben mit beiden Klassen durchführst:

## Status deiner Anwendung abrufen

`client.app_status` und `app.status` geben ein `StatusData`-Objekt zurück.

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        status = await client.app_status('application_id')  # StatusData(...)

        print(status.ram)      # '70MB'
        print(status.cpu)      # '5%'
        print(status.network)  # {'total': '0 KB ↑ 0 KB ↓', 'now': '0 KB ↑ 0 KB ↓'}
        print(status.running)  # True | False
        print(status.storage)  # '0B'
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')  # StatusData(...)
        status = await app.status()

        print(status.ram)  # '70MB'
        print(status.cpu)  # '5%'
        print(status.network)  # {'total': '0 KB ↑ 0 KB ↓', 'now': '0 KB ↑ 0 KB ↓'}
        print(status.running)  # True | False
        print(status.storage)  # '0B'
    ```
  </Tab>
</Tabs>

## Logs abrufen

`client.get_logs` und `app.logs` geben ein `LogsData`-Objekt zurück.

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        logs = await client.get_logs('application_id')

        print(logs)  # LogsData(logs='Hello World!')
        print(logs.logs)  # 'Hello World'
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')
        logs = await app.logs()

        print(logs)  # LogsData(logs='Hello World!')
        print(logs.logs)  # 'Hello World'
    ```
  </Tab>
</Tabs>

## Anwendung starten

`client.start_app` und `app.start` geben ein `Response`-Objekt zurück.

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        await client.start_app('application_id')
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')
        await app.start()
    ```
  </Tab>
</Tabs>

## Anwendung stoppen

`client.stop_app` und `app.stop` geben ein `Response`-Objekt zurück.

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        await client.stop_app('application_id')
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')
        await app.stop()
    ```
  </Tab>
</Tabs>

## Anwendung neu starten

`client.restart_app` und `app.restart` geben ein `Response`-Objekt zurück.

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        await client.restart_app('application_id')
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')
        await app.restart()
    ```
  </Tab>
</Tabs>

## Anwendung löschen

`client.delete_app` und `app.delete` geben ein `Response`-Objekt zurück.

<Warning>
  Dadurch wird deine Anwendung **DAUERHAFT** gelöscht. Das bedeutet, dass sie nicht wiederhergestellt werden kann, es sei denn, du hast ein Backup deiner Anwendung.
</Warning>

<Tabs>
  <Tab title="Über den Client">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        await client.delete_app('application_id')
    ```
  </Tab>

  <Tab title="Über die Application">
    ```python theme={null}
    import squarecloud as square

    client = square.Client(api_key='API KEY')

    async def example():
        app = await client.app('application_id')
        await app.delete()
    ```
  </Tab>
</Tabs>
