Skip to main content
Examples use the client from Creating the client. app_id is the id of one of your apps: client.account.me() lists them.

Accepted inputs

apps.create() and apps.commit() take: Uploads are limited to 100 MB. A larger file fails locally with FILE_TOO_LARGE (status 0) before anything is sent. Uploads are streamed and have no timeout once connected (see Timeouts).

Creating an application

apps.create(file) deploys a .zip that contains a squarecloud.app configuration file at its root. bytes and unnamed file objects are sent as app.zip.

Committing to an application

apps.commit(app_id, file, path=None, filename=None) uploads a file into an existing app. path and filename are keyword-only.
  • A .zip is unpacked at path (the app root by default).
  • Any other file lands at path/<filename>.
The filename is filename, else the file’s own name (path or file object), else commit.zip.
A commit does not restart the app. Call apps.restart() to apply it.

Cancelling an upload

Python uploads cannot be cancelled once sent: apps.create() and apps.commit() have no signal or cancel argument, and no timeout once connected. The connect itself is bounded by timeout. To keep the rest of your program responsive during a long upload, run it with AsyncSquareCloud (it runs in a worker thread) or in your own thread:

Errors

A local path that cannot be opened (or a file that becomes unreadable mid-upload) raises an OSError, not a SquareCloudAPIError. A missing path fails before anything is sent. See Errors for the full list.

Next steps

Managing files

List, read, write, move and delete app files.

Upload API reference

The REST endpoints behind these methods.

Upload from the CLI

The same actions from the terminal.