Get the 1&1 Python Cloud Server SDK
Table of Contents
- The wait_for() Method
- Supported Versions
The 1&1 Python SDK is a Python library designed for interaction with the 1&1 Cloud platform over the Cloud Server REST API. This allows you to automate many of the tasks which are otherwise available through the Cloud Panel UI.
The 1&1 Python SDK allows you to list and retrieve information about servers, including their hardware, IP addresses, load balancers, private networks, and more. You can create and delete servers, as well as reconfigure them. Hard drives, virtual DVD units, firewall policies, load balancers, and IP addresses can all be added or removed through the API.
The API also allows you to manage server operations. Servers can be added to or removed from private networks. Snapshots can be created, restored, or removed. Images can be created, updated, and deleted. Shared storages, firewall policies, load balancers, IP addresses, private networks, VPNs, monitoring policies, logs, usage, and appliances can all be managed through the API. Users and roles can be added, deleted, and managed, as well.
The wait_for() Method
wait_for() method can be used on any major class object to poll its resource until one of the following states is returned:
This is necessary when chaining together multiple actions that take some time to deploy. The
wait_for() method is available on the
You may pass in an optional timeout value (in minutes) which stops the
wait_for() method from polling after the given amount of time. timeout is set to 25 minutes by default. You may also set the interval value (in seconds). The default value for interval varies by class.
The 1&1 Python SDK is designed for Python 3.x.
Before you begin, you need to have a 1&1 account.
To enable the API token:
- Log in to your 1&1 Control Panel and select the relevant package.
- Click 1&1 Cloud Panel from the Cloud Server section of the control panel.
- Select Users from the Management section of the Infrastructure menu.
- Select the user who needs the API token.
- In the API section in the lower part of the screen, click Disabled next to the API KEY.
- Click OK to activate the API key.
The Python Client Library is available on PyPi. You can install the latest stable version using pip:
pip install 1and1
Connecting to 1&1 is handled by first setting up your authentication.
from oneandone.client import OneAndOneService client = OneAndOneService('API-TOKEN')
You can now use
client for any future requests.