Ploi Python Package
A Python package to interact with Ploi API.
Ploi is an awesome server management tool that lets you manage an Ubuntu server to host PHP applications with great flexibility. If you want to programatically interact with Ploi using Python, then this package will let you consume their API the easy way.
Installation
Install from PyPi:
pip install ploi
or clone this repo and run:
python setup.py install
Usage
from ploi.ploi import Ploi
ApiToken = '#############' # Your Ploi API Token
p = Ploi(ApiToken)
List Servers
p.list_servers()
Get a Server
p.get_server(serverId)
List Sites
p.list_sites(serverId)
Create a Site
data = {
'root_domain': 'example.com',
'web_directory': '/example/', # Slashes are compulsory
}
p.create_site(serverId, data=data)
Get a Site
p.show_site(serverId, siteId)
Delete a Site
p.delete_site(serverId, siteId)
List Databases
p.list_databases(serverId)
Create a Database
data = {
'name': 'dbname',
'user': 'dbuser',
'password': 'dbpassword'
}
p.create_database(serverId, data=data)
Get a Database
p.show_database(serverId, databaseId)
Delete a Database
p.delete_database(serverId, databaseId)
More methods will be supported in future versions as this is just a starting point.