Python API for communication with Portainer
Project description
py-portainer-api
Python library to interface with portainer
WARNING this is still very alpha, and a lot will change
Usage
You can import the module as portainer.
Constructor
Portainer(
portainer_ip: str,
portainer_port: int,
username: str,
password: str,
use_https: bool = False,
debugmode: bool = False,
)
Code example
import asyncio
from portainer import Portainer
from portainer.exceptions import PortainerException
portainer = Portainer("192.168.0.100", 9000, "admin", "Password")
try:
asyncio.run(portainer.login())
except PortainerException:
print("Error")
endpoints = asyncio.run(portainer.get_endpoints())
if endpoints is None:
print("No endpoints found")
else:
asyncio.run(endpoints[0].refresh())
asyncio.run(endpoints[0].docker_container["grocy"].get_image_status())
asyncio.run(endpoints[0].docker_container["grocy"].get_stats())
asyncio.run(endpoints[0].docker_container["grocy"].recreate())
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_portainer_api-0.0.3-py3-none-any.whl.
File metadata
- Download URL: py_portainer_api-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ada2b3b4585227b1ae95583aec293005a45035696e488f32074b6569f8ac2b24
|
|
| MD5 |
977536acd8a54e9d1412005cc9ec0d03
|
|
| BLAKE2b-256 |
9f121646534a78eb3cfc77977f3760c770a2271f205bb335a5df2478420abd90
|