All operations below can be performed by either the Client class, the
Application class and the CLI. Below are examples of how to perform each of
these tasks using both classes:
Getting the status of your application
client.app_status and app.status return a StatusData object.
Using Client
Using Application
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'
Getting logs
client.get_logs and app.logs return a LogsData object.
Using Client
Using Application
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'
Starting the application
client.start_app and app.start return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.start_app('application_id')
Stopping the application
client.stop_app and app.stop return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.stop_app('application_id')
Restarting the application
client.restart_app and app.restart return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.restart_app('application_id')
Deleting an application
client.delete_app and app.delete return a Response object.
This will delete your application PERMANENTLY, meaning that unless you have a backup of your application, it cannot be recovered.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.delete_app('application_id')