pydo.balance.get()

Description

To retrieve the balances on a customer’s account, send a GET request to /v2/customers/my/balance.

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

balance = client.balance.get()

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

The response will be a JSON object that contains the following attributes

Click to expand an example response.
{
  "month_to_date_balance": "23.44",
  "account_balance": "12.23",
  "month_to_date_usage": "11.21",
  "generated_at": "2019-07-09T15:01:12Z"
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}