Python Library for Tutum
Project description
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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-tutum-0.21.2.tar.gz
(34.8 kB
view details)
File details
Details for the file python-tutum-0.21.2.tar.gz
.
File metadata
- Download URL: python-tutum-0.21.2.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9dc2f6dd893b4243d8a794ce0e371989a4f6232523c6a934b50204cf0a187f |
|
MD5 | a6628b76df9557344eb111d192a82fc3 |
|
BLAKE2b-256 | 572866aee0ff752c583360d4b7cfadb3a3d56da110dad85ca00b2a56b40c8e14 |