Name | py-portainer-api JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Python API for communication with Portainer |
upload_time | 2023-04-22 09:18:13 |
maintainer | |
docs_url | None |
author | Lode Smets (lodesmets) |
requires_python | >=3.10.0 |
license | MIT |
keywords |
portainer
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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
```python
Portainer(
portainer_ip: str,
portainer_port: int,
username: str,
password: str,
use_https: bool = False,
debugmode: bool = False,
)
```
## Code example
```python
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())
```
Raw data
{
"_id": null,
"home_page": "",
"name": "py-portainer-api",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10.0",
"maintainer_email": "",
"keywords": "portainer",
"author": "Lode Smets (lodesmets)",
"author_email": "",
"download_url": "",
"platform": null,
"description": "# py-portainer-api\n\nPython library to interface with portainer\n\n# WARNING this is still very alpha, and a lot will change\n\n# Usage\n\nYou can import the module as `portainer`.\n\n## Constructor\n\n```python\nPortainer(\n portainer_ip: str,\n portainer_port: int,\n username: str,\n password: str,\n use_https: bool = False,\n debugmode: bool = False,\n)\n```\n\n## Code example\n\n```python\nimport asyncio\n\nfrom portainer import Portainer\nfrom portainer.exceptions import PortainerException\n\nportainer = Portainer(\"192.168.0.100\", 9000, \"admin\", \"Password\")\ntry:\n asyncio.run(portainer.login())\nexcept PortainerException:\n print(\"Error\")\n\nendpoints = asyncio.run(portainer.get_endpoints())\nif endpoints is None:\n print(\"No endpoints found\")\nelse:\n asyncio.run(endpoints[0].refresh())\n asyncio.run(endpoints[0].docker_container[\"grocy\"].get_image_status())\n asyncio.run(endpoints[0].docker_container[\"grocy\"].get_stats())\n asyncio.run(endpoints[0].docker_container[\"grocy\"].recreate())\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python API for communication with Portainer",
"version": "0.0.3",
"split_keywords": [
"portainer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9f121646534a78eb3cfc77977f3760c770a2271f205bb335a5df2478420abd90",
"md5": "977536acd8a54e9d1412005cc9ec0d03",
"sha256": "ada2b3b4585227b1ae95583aec293005a45035696e488f32074b6569f8ac2b24"
},
"downloads": -1,
"filename": "py_portainer_api-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "977536acd8a54e9d1412005cc9ec0d03",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10.0",
"size": 7848,
"upload_time": "2023-04-22T09:18:13",
"upload_time_iso_8601": "2023-04-22T09:18:13.487219Z",
"url": "https://files.pythonhosted.org/packages/9f/12/1646534a78eb3cfc77977f3760c770a2271f205bb335a5df2478420abd90/py_portainer_api-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-22 09:18:13",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "py-portainer-api"
}