portainer-py
Installation
portainer-py is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 3.5+.
$ pip install portainer-py
Usage
From the command line
The only command currently supported is deploy. Use the help function to find out how to use it:
$ portainerpy deploy --help
Usage: portainerpy deploy [OPTIONS]
Update and deploy a portainer stack.
To ease automation, this utility also support using environment variables
instead of using these command line options:
--user PORTAINER_USERNAME
--password PORTAINER_PASSWORD
--host PORTAINER_HOST
--stackname PORTAINER_STACK_NAME
--stackfile PORTAINER_STACKFILE
Options:
-f, --stackfile PATH Path to the stackfile.yml [required]
-h, --host TEXT URL to Portainer host [required]
-u, --user TEXT Portainer username [required]
-p, --password TEXT Portainer password
-n, --stackname TEXT Name of the Portainer stack [required]
-e, --env TEXT Environment variables to add to the stack
--prune-env If true, will remove existing environment variables
from the stack
--prune-stack Prune services that are no longer referenced
--help Show this message and exit.
From python
If you’re running Portainer locally, which should be very easy using Docker, connect to it like this:
from portainer_py import portainer_for_host
portainer = portainer_for_host("http://localhost:9000")
portainer.login("<username>", "<password>")
stack = portainer.stack_with_name("my-stack")
try:
portainer.update_stack(
stack["Id"],
"path/to/stackfile.yml",
env_vars={"foo": "bar"}
)
except: PortainerError as error:
print(error.message)
License
portainer-py is distributed under the terms of the MIT License.
Metadata
Release files for portainer-py 0.7.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| portainer-py-0.7.6.tar.gz | 11.3 kB | Without provenance | Details for portainer-py-0.7.6.tar.gz |
Release files / portainer-py-0.7.6.tar.gz
| Download URL | portainer-py-0.7.6.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1727575088bff0badb8efd7e6bed17a95f1c511ecfbececca5dc93b5465e52f8
|
|
BLAKE2b-256 checksum How to use checksums |
b54d4621b5f50039f29381c5199d77c30c7f30d1a56d833e3ff798584bea8998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
|
Security for portainer-py 0.7.6
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.