Skip to main content
There is no official Python package yet, so this page gives you a client to copy into your project (for example as camposcloud.py). It is plain requests, one method per endpoint, and it covers more than the JavaScript SDK: pagination, databases and your own error class.

The client

camposcloud.py
The code was tested against a local stand-in server that checks the method, path, headers, query string, multipart body, error handling and the retry on 429. It has not been published as a package, so read it before you depend on it.

Using it

Dont put your API Key directly in your code. Load it from an environment variable.

Applications

The extra arguments of create_app and update_app are the fields of POST /v1/apps/create and POST /v1/apps/{appId}/update, with the names the API uses. A value of None is left out of the request.

Files

The path is sent URL encoded, so spaces and characters such as & are safe. download always returns a zip, even for a single file.

Databases

See databases for what each type needs. The password is never returned by the API.

Errors

Every error status raises CamposCloudError, with the HTTP status and the message of the API. Use the status in your code, not the message:
A network failure or a timeout raises the exception of requests itself (requests.RequestException).

Rate limits

On a 429 the client waits the seconds in the Retry-After header and sends the request again, up to max_retries times (3 by default) before raising. A request that got 429 was refused, so repeating it is safe. Other errors are never retried. The limits are described in Limits. The ones you hit first are 1 creation, update or upload every 3 seconds. Space them out in loops.

Differences from the JavaScript SDK