Skip to main content

Python library for Tutum’s API. Full documentation available at https://docs.tutum.co/v2/api/?python

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):

  • Manually set it in your Python initialization code:

import tutum
tutum.user = "username"
tutum.apikey = "apikey"
  • Store it in a configuration file in ~/.tutum:

[auth]
user = "username"
apikey = "apikey"
  • Set the environment variables TUTUM_USER and TUTUM_APIKEY:

export TUTUM_USER=username
export 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

Services

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

Containers

>>> import tutum
>>> tutum.Container.list()
[<tutum.api.container.Container object at 0x10701ca90>, <tutum.api.container.Container object at 0x10701ca91>]
>>> container = tutum.Container.fetch("7d6696b7-fbaf-471d-8e6b-ce7052586c24")
<tutum.api.container.Container object at 0x10701ca90>
>>> container.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

Metadata

Release files for python-tutum 0.21.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-tutum 0.21.2
File Size Uploaded Provenance
python-tutum-0.21.2.tar.gz 34.8 kB Without provenance Details

Release files / python-tutum-0.21.2.tar.gz

Download URL python-tutum-0.21.2.tar.gz
Size 34.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9d9dc2f6dd893b4243d8a794ce0e371989a4f6232523c6a934b50204cf0a187f
BLAKE2b-256 checksum
How to use checksums
572866aee0ff752c583360d4b7cfadb3a3d56da110dad85ca00b2a56b40c8e14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-tutum 0.21.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.21.2 This release

1 release file No provenance

0.15.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page