# digitalocean package

## Submodules

## digitalocean.Account module

class digitalocean.Account.Account(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  classmethod get_object(api_token)

    Class method that will return an Account object.

  load()

## digitalocean.Action module

class digitalocean.Action.Action(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  classmethod get_object(api_token, action_id)

    Class method that will return a Action object by ID.

  load()
  load_directly()
  wait(update_every_seconds=1)

    Wait until the action is marked as completed or with an error. It will return True in case of success, otherwise False.

    Optional Args:
      update_every_seconds - intnumber of seconds to wait before

        checking if the action is completed.

## digitalocean.Domain module

class digitalocean.Domain.Domain(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  create()

    Create new doamin

  create_new_domain_record(*args, **kwargs)

    Create new domain record. https://developers.digitalocean.com/#create-a-new-domain-record

    Parameters

      - type – The record type (A, MX, CNAME, etc).

      - name – The host name, alias, or service being defined by the record

      - data – Variable data depending on record type.

    Optional Args:

      priority: The priority of the host port: The port that the service is accessible on weight: The weight of records with the same priority ttl: This value is the time to live for the record, in seconds. flags: An unsigned integer between 0-255 used for CAA records. tag: The parameter tag for CAA records. Valid values are “issue”,

      > “issuewild”, or “iodef”.

  destroy()

    Destroy the domain by name

  classmethod get_object(api_token, domain_name)

    Class method that will return a Domain object by ID.

  get_records(params=None)

    Returns a list of Record objects

  load()

## digitalocean.Droplet module

exception digitalocean.Droplet.BadKernelObject

  Bases: `digitalocean.Droplet.DropletError`

exception digitalocean.Droplet.BadSSHKeyFormat

  Bases: `digitalocean.Droplet.DropletError`

class digitalocean.Droplet.Droplet(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  Droplet management

  Attributes accepted at creation time:

  Parameters

    - name (str) – name

    - size_slug (str) – droplet size

    - image (str) – image name to use to create droplet

    - region (str) – region

    - ssh_keys (`str`, optional) – list of ssh keys

    - backups (bool) – True if backups enabled

    - ipv6 (bool) – True if ipv6 enabled

    - private_networking (bool) – True if private networking enabled

    - user_data (str) – arbitrary data to pass to droplet

    - volumes (`str`, optional) – list of blockstorage volumes

    - monitoring (bool) – True if installing the DigitalOcean monitoring agent

    - vpc_uuid (str, optional) – ID of a VPC in which the Droplet will be created

  Attributes returned by API:

    - id (int): droplet id

    - memory (str): memory size

    - vcpus (int): number of vcpus

    - disk (int): disk size in GB

    - locked (bool): True if locked

    - created_at (str): creation date in format u’2014-11-06T10:42:09Z’

    - status (str): status, e.g. ‘new’, ‘active’, etc

    - networks (dict): details of connected networks

    - kernel (dict): details of kernel

    - backup_ids (`int`, optional): list of ids of backups of this droplet

    - snapshot_ids (`int`, optional): list of ids of snapshots of this droplet

    - action_ids (`int`, optional): list of ids of actions

    - features (`str`, optional): list of enabled features. e.g.

        [u’private_networking’, u’virtio’]

    - image (dict): details of image used to create this droplet

    - ip_address (str): public ip addresses

    - private_ip_address (str): private ip address

    - ip_v6_address (`str`, optional): list of ipv6 addresses assigned

    - end_point (str): url of api endpoint used

    - volume_ids (`str`, optional): list of blockstorage volumes

    - vpc_uuid (str, optional): ID of the VPC that the Droplet is assigned to

  change_kernel(kernel, return_dict=True)

    Change the kernel to a new one

    Parameters

      kernel – instance of digitalocean.Kernel.Kernel

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  create(*args, **kwargs)

    Create the droplet with object properties.

    Note: Every argument and parameter given to this method will be assigned to the object.

  classmethod create_multiple(*args, **kwargs)
  destroy()

    Destroy the droplet

    Returns dict

  disable_backups(return_dict=True)

    Disable automatic backups

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  enable_backups(return_dict=True)

    Enable automatic backups

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  enable_ipv6(return_dict=True)

    Enable IPv6 on an existing Droplet where available.

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  enable_private_networking(return_dict=True)

    Enable private networking on an existing Droplet where available.

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  get_action(action_id)

    Returns a specific Action by its ID.

    Parameters

      action_id (int) – id of action

  get_actions()

    Returns a list of Action objects This actions can be used to check the droplet’s status

  get_data(*args, **kwargs)

    Customized version of get_data to perform __check_actions_in_data

  get_events()

    A helper function for backwards compatibility. Calls get_actions()

  get_kernel_available()

    Get a list of kernels available

  classmethod get_object(api_token, droplet_id)

    Class method that will return a Droplet object by ID.

    Parameters

      - api_token (str) – token

      - droplet_id (int) – droplet id

  get_snapshots()

    This method will return the snapshots/images connected to that specific droplet.

  load()

    Fetch data about droplet - use this instead of get_data()

  power_cycle(return_dict=True)

    restart the droplet

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  power_off(return_dict=True)

    restart the droplet

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  power_on(return_dict=True)

    Boot up the droplet

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  reboot(return_dict=True)

    restart the droplet

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  rebuild(image_id=None, return_dict=True)

    Restore the droplet to an image ( snapshot or backup )

    Parameters

      image_id (int) – id of image

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  rename(name, return_dict=True)

    Rename the droplet

    Parameters

      name (str) – new name

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  reset_root_password(return_dict=True)

    reset the root password

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  resize(new_size_slug, return_dict=True, disk=True)

    Resize the droplet to a new size slug. https://developers.digitalocean.com/documentation/v2/#resize-a-droplet

    Parameters

      new_size_slug (str) – name of new size

    Optional Args:

      return_dict (bool): Return a dict when True (default), otherwise return an Action. disk (bool): If a permanent resize, with disk changes included.

    Returns dict or Action

  restore(image_id, return_dict=True)

    Restore the droplet to an image ( snapshot or backup )

    Parameters

      image_id (int) – id of image

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  shutdown(return_dict=True)

    shutdown the droplet

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

    Returns dict or Action

  take_snapshot(snapshot_name, return_dict=True, power_off=False)

    Take a snapshot!

    Parameters

      snapshot_name (str) – name of snapshot

    Optional Args:
      return_dict (bool): Return a dict when True (default),

        otherwise return an Action.

      power_off (bool): Before taking the snapshot the droplet will be

        turned off with another API call. It will wait until the droplet will be powered off.

    Returns dict or Action

  update_volumes_data()

    Trigger volume objects list refresh. When called on a droplet instance, it will take all volumes ids(gathered in initial droplet details collection) and will create list of object of Volume types. Each volume is a separate api call.

exception digitalocean.Droplet.DropletError

  Bases: `digitalocean.Error`

  Base exception class for this module

## digitalocean.FloatingIP module

class digitalocean.FloatingIP.FloatingIP(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  assign(droplet_id)

    Assign a FloatingIP to a Droplet.

    Parameters

      droplet_id – int - droplet id

  create(*args, **kwargs)

    Creates a FloatingIP and assigns it to a Droplet.

    Note: Every argument and parameter given to this method will be assigned to the object.

    Parameters

      droplet_id – int - droplet id

  destroy()

    Destroy the FloatingIP

  classmethod get_object(api_token, ip)

    Class method that will return a FloatingIP object by its IP.

    Parameters

      - api_token – str - token

      - ip – str - floating ip address

  load()

    Load the FloatingIP object from DigitalOcean.

    Requires self.ip to be set.

  reserve(*args, **kwargs)

    Creates a FloatingIP in a region without assigning it to a specific Droplet.

    Note: Every argument and parameter given to this method will be assigned to the object.

    Parameters

      region_slug – str - region’s slug (e.g. ‘nyc3’)

  unassign()

    Unassign a FloatingIP.

## digitalocean.Image module

class digitalocean.Image.Image(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  An object representing an DigitalOcean Image.

  Attributes accepted at creation time:

  Parameters

    - name (str) – The name to be given to an image.

    - url (str) – A URL from which the virtual machine image may be retrieved.

    - region (str) – The slug of the region where the image will be available.

    - distribution (str, optional) – The name of the image’s distribution.

    - description (str, optional) – Free-form text field to describe an image.

    - (obj (tags) – list of str, optional): List of tag names to apply to the image.

  Attributes returned by API:

    - id (int): A unique number to identify and reference a image.

    - name (str): The display name given to an image.

    - type (str): The kind of image. This will be either “snapshot”,

        “backup”, or “custom”.

    - distribution (str): The name of the image’s distribution.

    - slug (str): A uniquely identifying string that is associated with each of the DigitalOcean-provided public images.

    - public (bool): Indicates whether the image is public or not.

    - regions (obj:list of str): A list of the slugs of the regions where the image is available for use.

    - created_at (str): A time value given in ISO8601 combined date and time format that represents when the image was created.

    - min_disk_size (int): The minimum disk size in GB required for a Droplet to use this image.

    - size_gigabytes (int): The size of the image in gigabytes.

    - description (str): Free-form text field to describing an image.

    - tags (obj:list of str): List of tag names to applied to the image.

    - status (str): Indicates the state of a custom image. This may be “NEW”, “available”, “pending”, or “deleted”.

    - error_message (str): Information about errors that may occur when importing a custom image.

  create()

    Creates a new custom DigitalOcean Image from the Linux virtual machine image located at the provided url.

  destroy()

    Destroy the image

  classmethod get_object(api_token, image_id_or_slug)

    Class method that will return an Image object by ID or slug.

    This method is used to validate the type of the image. If it is a number, it will be considered as an Image ID, instead if it is a string, it will considered as slug.

  load(use_slug=False)

    Load slug.

    Loads by id, or by slug if id is not present or use slug is True.

  rename(new_name)

    Rename an image

  transfer(new_region_slug)

    Transfer the image

## digitalocean.Kernel module

class digitalocean.Kernel.Kernel(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

## digitalocean.LoadBalancer module

class digitalocean.LoadBalancer.ForwardingRule(entry_protocol=None, entry_port=None, target_protocol=None, target_port=None, certificate_id='', tls_passthrough=False)

  Bases: `object`

  An object holding information about a LoadBalancer forwarding rule setting.

  Parameters

    - entry_protocol (str) – The protocol used for traffic to a LoadBalancer. The possible values are: “http”, “https”, or “tcp”

    - entry_port (int) – The port the LoadBalancer instance will listen on

    - target_protocol (str) – The protocol used for traffic from a LoadBalancer to the backend Droplets. The possible values are: “http”, “https”, or “tcp”

    - target_port (int) – The port on the backend Droplets on which the LoadBalancer will send traffic

    - certificate_id (str, optional) – The ID of the TLS certificate used for SSL termination if enabled

    - tls_passthrough (bool, optional) – A boolean indicating if SSL encrypted traffic will be passed through to the backend Droplets

class digitalocean.LoadBalancer.HealthCheck(protocol='http', port=80, path='/', check_interval_seconds=10, response_timeout_seconds=5, healthy_threshold=5, unhealthy_threshold=3)

  Bases: `object`

  An object holding information about a LoadBalancer health check settings.

  Parameters

    - protocol (str) – The protocol used for health checks. The possible values are “http” or “tcp”.

    - port (int) – The port on the backend Droplets for heath checks

    - path (str) – The path to send a health check request to

    - check_interval_seconds (int) – The number of seconds between between two consecutive health checks

    - response_timeout_seconds (int) – The number of seconds the Load Balancer instance will wait for a response until marking a check as failed

    - healthy_threshold (int) – The number of times a health check must fail for a backend Droplet to be removed from the pool

    - unhealthy_threshold (int) – The number of times a health check must pass for a backend Droplet to be re-added to the pool

class digitalocean.LoadBalancer.LoadBalancer(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  An object representing an DigitalOcean Load Balancer.

  Attributes accepted at creation time:

  Parameters

    - name (str) – The Load Balancer’s name

    - region (str) – The slug identifier for a DigitalOcean region

    - algorithm (str, optional) – The load balancing algorithm to be used. Currently, it must be either “round_robin” or “least_connections”

    - (obj (droplet_ids) – list): A list of ForwrdingRules objects

    - health_check (obj, optional) – A HealthCheck object

    - sticky_sessions (obj, optional) – A StickySessions object

    - redirect_http_to_https (bool, optional) – A boolean indicating whether HTTP requests to the Load Balancer should be redirected to HTTPS

    - (obj – list of int): A list of IDs representing Droplets to be added to the Load Balancer (mutually exclusive with ‘tag’)

    - tag (str) – A string representing a DigitalOcean Droplet tag (mutually exclusive with ‘droplet_ids’)

    - vpc_uuid (str) – ID of a VPC in which the Load Balancer will be created

  Attributes returned by API:

    - name (str): The Load Balancer’s name

    - id (str): An unique identifier for a LoadBalancer

    - ip (str): Public IP address for a LoadBalancer

    - region (str): The slug identifier for a DigitalOcean region

    - algorithm (str, optional): The load balancing algorithm to be used. Currently, it must be either “round_robin” or “least_connections”

    - forwarding_rules (obj:list): A list of ForwrdingRules objects

    - health_check (obj, optional): A HealthCheck object

    - sticky_sessions (obj, optional): A StickySessions object

    - redirect_http_to_https (bool, optional): A boolean indicating whether HTTP requests to the Load Balancer should be redirected to HTTPS

    - droplet_ids (obj:list of int): A list of IDs representing Droplets to be added to the Load Balancer

    - tag (str): A string representing a DigitalOcean Droplet tag

    - status (string): An indication the current state of the LoadBalancer

    - created_at (str): The date and time when the LoadBalancer was created

    - vpc_uuid (str): ID of a VPC which the Load Balancer is assigned to

  add_droplets(droplet_ids)

    Assign a LoadBalancer to a Droplet.

    Parameters

      (obj (droplet_ids) – list of int): A list of Droplet IDs

  add_forwarding_rules(forwarding_rules)

    Adds new forwarding rules to a LoadBalancer.

    Parameters

      (obj (forwarding_rules) – list): A list of ForwrdingRules objects

  create(*args, **kwargs)

    Creates a new LoadBalancer.

    Note: Every argument and parameter given to this method will be assigned to the object.

    Parameters

      - name (str) – The Load Balancer’s name

      - region (str) – The slug identifier for a DigitalOcean region

      - algorithm (str, optional) – The load balancing algorithm to be used. Currently, it must be either “round_robin” or “least_connections”

      - (obj (droplet_ids) – list): A list of ForwrdingRules objects

      - health_check (obj, optional) – A HealthCheck object

      - sticky_sessions (obj, optional) – A StickySessions object

      - redirect_http_to_https (bool, optional) – A boolean indicating whether HTTP requests to the Load Balancer should be redirected to HTTPS

      - (obj – list of int): A list of IDs representing Droplets to be added to the Load Balancer (mutually exclusive with ‘tag’)

      - tag (str) – A string representing a DigitalOcean Droplet tag (mutually exclusive with ‘droplet_ids’)

      - vpc_uuid (str) – ID of a Load Balancer in which the Droplet will be created

  destroy()

    Destroy the LoadBalancer

  classmethod get_object(api_token, id)

    Class method that will return a LoadBalancer object by its ID.

    Parameters

      - api_token (str) – DigitalOcean API token

      - id (str) – Load Balancer ID

  load()

    Loads updated attributues for a LoadBalancer object.

    Requires self.id to be set.

  remove_droplets(droplet_ids)

    Unassign a LoadBalancer.

    Parameters

      (obj (droplet_ids) – list of int): A list of Droplet IDs

  remove_forwarding_rules(forwarding_rules)

    Removes existing forwarding rules from a LoadBalancer.

    Parameters

      (obj (forwarding_rules) – list): A list of ForwrdingRules objects

  save()

    Save the LoadBalancer

class digitalocean.LoadBalancer.StickySessions(type='none', cookie_name='', cookie_ttl_seconds=None, **kwargs)

  Bases: `object`

  An object holding information on a LoadBalancer’s sticky sessions settings.

  Parameters

    - type (str) – The type of sticky sessions used. Can be “cookies” or “none”

    - cookie_name (str, optional) – The name used for the client cookie when using cookies for sticky session

    - cookie_ttl_seconds (int, optional) – The number of seconds until the cookie expires

## digitalocean.Manager module

class digitalocean.Manager.Manager(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  get_account()

    Returns an Account object.

  get_action(action_id)

    Return an Action object by a specific ID.

  get_all_certificates()

    This function returns a list of Certificate objects.

  get_all_domains()

    This function returns a list of Domain object.

  get_all_droplets(params=None, tag_name=None)

    This function returns a list of Droplet object.

  get_all_firewalls()

    This function returns a list of Firewall objects.

  get_all_floating_ips()

    This function returns a list of FloatingIP objects.

  get_all_images()

    This function returns a list of Image objects containing all available DigitalOcean images, both public and private.

  get_all_load_balancers()

    Returns a list of Load Balancer objects.

  get_all_projects()

    All the projects of the account

  get_all_regions()

    This function returns a list of Region object.

  get_all_sizes()

    This function returns a list of Size object.

  get_all_snapshots()

    This method returns a list of all Snapshots.

  get_all_sshkeys()

    This function returns a list of SSHKey object.

  get_all_tags()

    This method returns a list of all tags.

  get_all_volumes(region=None)

    This function returns a list of Volume objects.

  get_all_vpcs()

    This function returns a list of VPC objects.

  get_app_images()

    This function returns a list of Image objectobjects representing public DigitalOcean ‘One-Click’ application images.

  get_balance()

    Returns a Balance object.

  get_certificate(id)

    Returns a Certificate object by its ID.

    Parameters

      id (str) – Certificate ID

  get_default_project()

    Return default project of the account

  get_distro_images()

    This function returns a list of Image objects representing public base distribution images.

  get_domain(domain_name)

    Return a Domain by its domain_name

  get_droplet(droplet_id)

    Return a Droplet by its ID.

  get_droplet_snapshots()

    This method returns a list of all Snapshots based on Droplets.

  get_firewall(firewall_id)

    Return a Firewall by its ID.

  get_floating_ip(ip)

    Returns a of FloatingIP object by its IP address.

  get_global_images()

    This function returns a list of Image objects representing public DigitalOcean images (e.g. base distribution images and ‘One-Click’ applications).

  get_image(image_id_or_slug)

    Return a Image by its ID/Slug.

  get_images(private=False, type=None)

    This function returns a list of Image object.

  get_load_balancer(id)

    Returns a Load Balancer object by its ID.

    Parameters

      id (str) – Load Balancer ID

  get_my_images()

    This function returns a list of Image objects representing private DigitalOcean images (e.g. snapshots and backups).

  get_project(project_id)

    Return a Project by its ID.

  get_snapshot(snapshot_id)

    Return a Snapshot by its ID.

  get_ssh_key(ssh_key_id)

    Return a SSHKey object by its ID.

  get_volume(volume_id)

    Returns a Volume object by its ID.

  get_volume_snapshots()

    This method returns a list of all Snapshots based on volumes.

  get_vpc(id)
    Returns a VPC object by its ID.
      Args:

        id (str): The VPC’s ID

## digitalocean.Metadata module

class digitalocean.Metadata.Metadata(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  Metadata API: Provide useful information about the current Droplet. See: https://developers.digitalocean.com/metadata/#introduction

  droplet_id = None
  end_point = 'http://169.254.169.254/metadata/v1'
  get_data(url, headers={}, params={}, render_json=True)

    Customized version of get_data to directly get the data without using the authentication method.

  load()

## digitalocean.Record module

class digitalocean.Record.Record(domain_name=None, *args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  An object representing an DigitalOcean Domain Record.

  Parameters

    - type (str) – The type of the DNS record (e.g. A, CNAME, TXT).

    - name (str) – The host name, alias, or service being defined by the record.

    - data (int) – Variable data depending on record type.

    - priority (int) – The priority for SRV and MX records.

    - port (int) – The port for SRV records.

    - ttl (int) – The time to live for the record, in seconds.

    - weight (int) – The weight for SRV records.

    - flags (int) – An unsigned integer between 0-255 used for CAA records.

    - tags (string) – The parameter tag for CAA records. Valid values are “issue”, “wildissue”, or “iodef”

  create()

    Creates a new record for a domain.

    Parameters

      - type (str) – The type of the DNS record (e.g. A, CNAME, TXT).

      - name (str) – The host name, alias, or service being defined by the record.

      - data (int) – Variable data depending on record type.

      - priority (int) – The priority for SRV and MX records.

      - port (int) – The port for SRV records.

      - ttl (int) – The time to live for the record, in seconds.

      - weight (int) – The weight for SRV records.

      - flags (int) – An unsigned integer between 0-255 used for CAA records.

      - tags (string) – The parameter tag for CAA records. Valid values are “issue”, “wildissue”, or “iodef”

  destroy()

    Destroy the record

  classmethod get_object(api_token, domain, record_id)

    Class method that will return a Record object by ID and the domain.

  load()
  save()

    Save existing record

## digitalocean.Region module

class digitalocean.Region.Region(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

## digitalocean.SSHKey module

class digitalocean.SSHKey.SSHKey(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  create()

    Create the SSH Key

  destroy()

    Destroy the SSH Key

  edit()

    Edit the SSH Key

  classmethod get_object(api_token, ssh_key_id)

    Class method that will return a SSHKey object by ID.

  load()

    Load the SSHKey object from DigitalOcean.

    Requires either self.id or self.fingerprint to be set.

  load_by_pub_key(public_key)

    This method will load a SSHKey object from DigitalOcean from a public_key. This method will avoid problems like uploading the same public_key twice.

## digitalocean.Size module

class digitalocean.Size.Size(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

## digitalocean.Tag module

class digitalocean.Tag.Tag(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  add_droplets(droplet)

    Add the Tag to a Droplet.

    Attributes accepted at creation time:

      droplet: array of string or array of int, or array of Droplets.

  add_snapshots(snapshots)

    Add the Tag to the Snapshot.

    Attributes accepted at creation time:

      snapshots: array of string or array of int or array of Snapshot.

  create(**kwargs)

    Create the tag.

  delete()
  classmethod get_object(api_token, tag_name)
  load()

    Fetch data about tag

  remove_droplets(droplet)

    Remove the Tag from the Droplet.

    Attributes accepted at creation time:

      droplet: array of string or array of int, or array of Droplets.

  remove_snapshots(snapshots)

    remove the Tag from the Snapshot.

    Attributes accepted at creation time:

      snapshots: array of string or array of int or array of Snapshot.

## digitalocean.Volume module

class digitalocean.Volume.Volume(*args, **kwargs)

  Bases: `digitalocean.BaseAPI`

  attach(droplet_id, region)

    Attach a Volume to a Droplet.

    Parameters

      - droplet_id – int - droplet id

      - region – string - slug identifier for the region

  create(*args, **kwargs)

    Creates a Block Storage volume

    Note: Every argument and parameter given to this method will be assigned to the object.

    Parameters

      - name – string - a name for the volume

      - region – string - slug identifier for the region

      - size_gigabytes – int - size of the Block Storage volume in GiB

      - filesystem_type – string, optional - name of the filesystem type the volume will be formatted with (‘ext4’ or ‘xfs’)

      - filesystem_label – string, optional - the label to be applied to the filesystem, only used in conjunction with filesystem_type

    Optional Args:

      description: string - text field to describe a volume tags: List[string], optional - the tags to be applied to the volume

  create_from_snapshot(*args, **kwargs)

    Creates a Block Storage volume

    Note: Every argument and parameter given to this method will be assigned to the object.

    Parameters

      - name – string - a name for the volume

      - snapshot_id – string - unique identifier for the volume snapshot

      - size_gigabytes – int - size of the Block Storage volume in GiB

      - filesystem_type – string, optional - name of the filesystem type the volume will be formatted with (‘ext4’ or ‘xfs’)

      - filesystem_label – string, optional - the label to be applied to the filesystem, only used in conjunction with filesystem_type

    Optional Args:

      description: string - text field to describe a volume tags: List[string], optional - the tags to be applied to the volume

  destroy()

    Destroy a volume

  detach(droplet_id, region)

    Detach a Volume to a Droplet.

    Parameters

      - droplet_id – int - droplet id

      - region – string - slug identifier for the region

  classmethod get_object(api_token, volume_id)

    Class method that will return an Volume object by ID.

  get_snapshots()

    Retrieve the list of snapshots that have been created from a volume.

    Args:

  load()
  resize(size_gigabytes, region)

    Detach a Volume to a Droplet.

    Parameters

      - size_gigabytes – int - size of the Block Storage volume in GiB

      - region – string - slug identifier for the region

  snapshot(name)

    Create a snapshot of the volume.

    Parameters

      name – string - a human-readable name for the snapshot

## digitalocean.baseapi module

## Module contents

digitalocean API to manage droplets

exception digitalocean.DataReadError

  Bases: `digitalocean.Error`

exception digitalocean.EndPointError

  Bases: `digitalocean.Error`

exception digitalocean.Error

  Bases: `Exception`

  Base exception class for this module

exception digitalocean.NotFoundError

  Bases: `digitalocean.Error`

exception digitalocean.TokenError

  Bases: `digitalocean.Error`