skip to navigation
skip to content

Not Logged In

python-tutum 0.6.3.5

Python Library for Tutum

Latest Version: 0.12.6

Python library for Tutum’s API. Full documentation available at http://docs.tutum.co/reference/api/

Installing the library

In order to install the Tutum Python library, you can use pip install:

pip install python-tutum

It will install a Python module called tutum which you can use to interface with the API.

Authorization

In order to be able to make requests to the API, you should first obtain an ApiKey for your account. For this, log into Tutum, click on the menu on the upper right corner of the screen, and select Get Api Key

You can use your ApiKey with the Python library in any of the following ways (will be used in this order):

  • Set the environment variables TUTUM_USER and TUTUM_APIKEY:
export TUTUM_USER=username
export TUTUM_APIKEY=apikey
  • Manually set it in your Python initialization code:
import tutum
tutum.user = "username"
tutum.apikey = "apikey"

Errors

Errors in the HTTP API will be returned with status codes in the 4xx and 5xx ranges.

The Python library will detect this status codes and raise TutumApiError exceptions with the error message, which should be handled by the calling application accordingly.

Quick examples

Applications

>>> import tutum
>>> tutum.Application.list()
[<tutum.api.application.Application object at 0x10701ca90>, <tutum.api.application.Application object at 0x10701ca91>]
>>> tutum.Application.fetch("fee900c6-97da-46b3-a21c-e2b50ed07015")
<tutum.api.application.Application object at 0x106c45c10>
>>> app.name
"my-python-app"
>>> app = tutum.Application.create(image="tutum/hello-world", name="my-new-app", target_num_containers=2)
>>> app.save()
True
>>> app.target_num_containers = 3
>>> app.save()
True
>>> app.stop()
True
>>> app.start()
True
>>> app.delete()
True

Containers

>>> import tutum
>>> tutum.Container.list()
[<tutum.api.container.Container object at 0x10701ca90>, <tutum.api.container.Container object at 0x10701ca91>]
>>> tutum.Container.fetch("7d6696b7-fbaf-471d-8e6b-ce7052586c24")
<tutum.api.container.Container object at 0x10701ca90>
>>> container.web_public_dns = "my-web-app.example.com"
>>> container.save()
True
>>> container.stop()
True
>>> container.start()
True
>>> container.logs
"2014-03-24 23:58:08,973 CRIT Supervisor running as root (no user in config file) [...]"
>>> container.delete()
True

Roles

>>> import tutum
>>> tutum.Role.list()
[<tutum.api.role.Role object at 0x10701ca90>]
>>> tutum.Role.fetch("global")
<tutum.api.role.Role object at 0x10701ca90>
 
File Type Py Version Uploaded on Size
python-tutum-0.6.3.5.tar.gz (md5) Source 2014-04-04 4KB
  • Downloads (All Versions):
  • 85 downloads in the last day
  • 892 downloads in the last week
  • 1094 downloads in the last month
  • Author: Tutum, Inc.
  • Home Page: http://www.tutum.co/
  • Keywords: tutum docker
  • License: Apache v2
  • Package Index Owner: fermayo, bernardopericacho, tifayuki
  • Package Index Maintainer: bernardopericacho, tifayuki
  • DOAP record: python-tutum-0.6.3.5.xml