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.
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 a list of files
client.app_files_list and app.files_list return a list of FileInfo objects.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
files_list = await client.app_files_list(app_id='application_id', path='/')
for file in files_list:
print(file.name) # 'main.py'
print(file.type) # 'directory' or 'file'
print(file.size) # 2140
print(file.lastModified) # 1677112835000
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
app = await client.app('application_id')
files_list = await app.files_list(path='/') # list[FileInfo(...)]
for file in files_list:
print(file.name) # 'main.py'
print(file.type) # 'directory' or 'file'
print(file.size) # 2140
print(file.lastModified) # 1677112835000
Reading a file
client.read_app_file and app.read_file return a BytesIO object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
file_bytes = await client.read_app_file(
app_id='application_id', path='main.py'
)
print(file_bytes) # b'01101000 01101001'
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
app = await client.app('application_id')
file_bytes = await app.read_file(path='main.py')
print(file_bytes) # b'01101000 01101001'
Creating a file
client.create_app_file and app.create_file return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.create_app_file(
app_id='application_id', path='/file.txt', file=square.File('file.txt')
)
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
app = await client.app('application_id')
await app.create_file(path='/file.txt', file=square.File('file.txt'))
Deleting a file
client.delete_app_file and app.delete_file return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.delete_app_file(app_id='application_id', path='/file.txt')
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
app = await client.app('application_id')
await app.delete_file(path='/file.txt')
Moving a file
client.move_app_file and app.move_file return a Response object.
Using Client
Using Application
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
await client.move_app_file(
app_id='application_id',
origin='path/to/origin/file.py',
dest='path/to/destination/file.py',
)
import squarecloud as square
client = square.Client(api_key='API KEY')
async def example():
app = await client.app('application_id')
await app.move_file(
origin='path/to/origin/file.py', dest='path/to/destination/file.py'
)