{
"info": {
"author": "Sandro Mello",
"author_email": "sandromll@gmail.com",
"bugtrack_url": null,
"classifiers": [],
"description": "Pypleskapi\n==========\n\nEasy requests to `Parallels Plesk Panel API RPC `_.\n\nAbout\n-----\nInstead of building complex structures of XML, you can write all the requests in dict types.\nPypleskapi converts dict type packets into XML structures, and so as the other way around,\nyou just need to know how to write the corresponding dict structure.\n\n.. code-block:: pycon\n\n >>> from pleskapi import StructDict\n >>> from pleskapi import send_packet\n\n >>> packet = StructDict('1.6.3.5')\n >>> packet['webspace']['get']['filter'] = {'name' : 'domain.tld'}\n >>> packet['webspace']['get']['dataset']['gen_info']\n\n >>> print packet.dict()\n {'packet': {'webspace': {'get': {'filter': {'name': 'domain.tld'}, 'dataset': {'gen_info': {}}}}, '@version': '1.6.3.5'}}\n\n >>> print packet.xml(True)\n \n \n \n \n \n domain.tld\n \n \n \n \n \n \n \n\n >>> r = send_packet(packet.dict())\n >>> r.response()\n {'version': '1.6.3.5', 'result': {'status': 'ok', 'filter-id': 'domain.tld', 'id': '36'}}\n\t\nStructDict builds chain's of dict without expliciting, common dict's are build this way:\n\n.. code-block:: pycon\n\n\t>>> d = dict() or {}\n\t>>> d['webspace'] = {}\n\t{'webspace': {}}\n\nYou need to create a new dict for every key:\n\n.. code-block:: pycon\n\n\t>>> d['webspace'] = {}\n\t>>> d['webspace']['get'] = {}\n\t{'webspace': {'get': {}}}\n\t>>> d['webspace']['get']['filter'] = { 'name' : 'domain.tld' }\n\tTraceback (most recent call last):\n\t File \"\", line 1, in \n\tKeyError: 'get'\n\nWith StructDict you can build chain's of dict:\n\n.. code-block:: pycon\n\n\t>>> from pleskapi import StructDict\n\t\"\"\" 1.6.3.5 refer to packet header body - ... \"\"\"\n\t>>> sd = StructDict('1.6.3.5')\n\t>>> sd['webspace']['get']['filter']\n\t{}\n\t>>> sd\n\t{'webspace': {'get': {'filter': {}}}}\n\t>>> print sd.xml()\n\t\n\nReference: `Plesk API `_.\nThe conversion is based in `Hay's project `_.\n\nInstallation\n------------\n\nThe following command will install pleskapi into your Python modules library:\n\n.. code-block:: bash\n\n $ python setup.py install\n\nThis command will generally need to be run with an administrative level account.\n\nOr:\n\n.. code-block:: bash\n\n $ pip install pypleskapi\n\nPre-requisites\n--------------\n\nIf you want to build ordered dict's, you MUST have python2.7+ or `OrderedDict `_.\n\nOverview\n--------\n\nBefore starting this topic, I recommend the reading of `API RPC Manual ` for\nbetter understanding how it works.\nFor building dict structures that will become valid requests to Plesk API RPC, you need to understand how a dict represents an XML structure.\nThe conversion follow the example bellow:\n\n.. code-block:: xml\n\n XML JSON\n \"e\": null\n text \"e\": \"text\"\n \"e\": { \"@name\": \"value\" }\n text \"e\": { \"@name\": \"value\", \"#text\": \"text\" }\n texttext \"e\": { \"a\": \"text\", \"b\": \"text\" }\n text text \"e\": { \"a\": [\"text\", \"text\"] }\n text text \"e\": { \"#text\": \"text\", \"a\": \"text\" }\n\nReference: `Converting Between XML and JSON `_.\n\nAn easy way of understanding it's using the converter functions, you can convert from an XML structure to a python dict type\n\n.. code-block:: pycon\n\n\t>>> from pleskapi import converter as conv\n\t>>> xmlstr = ''\n\t>>> conv.xml2dict(xmlstr)\n\t{'packet': {'webspace': {'get': {'filter': None}}, '@version': '1.6.3.5'}}\n\nOrdering Dict's\n---------------\n\nPlesk RPC API needs that the XML structure follow a specific order, more info: `API RPC Manual`_ - API RPC > API RPC Packets > How to Create Packets.\n\n.. _`API RPC Manual`: http://www.parallels.com/download/plesk/11/documentation/\n\nA python dict type is unordered, so you need to use an OrderedDict type for ordering only the necessary keys.\nLet's consider the XML string bellow:\n\n.. code-block:: xml\n\n\t\n\t\n\t \n\t \n\t 192.0.2.18\n\t 255.255.255.0\n\t shared\n\t eth0\n\t \n\t \n\t\n\nip_address node must be the first, netmask the second and so on.\nBuilding this structure without using OrderedDict, outputs to:\n\n.. code-block:: pycon\n\n\t>>> from pleskapi import StructDict as sd\n\n\t>>> sd['ip']['add'] = {}\n\t>>> sd['ip']['add']['ip_address'] = '192.0.2.18'\n\t>>> sd['ip']['add']['netmask'] = '255.255.255.0'\n\t>>> sd['ip']['add']['type'] = 'shared'\n\t>>> sd['ip']['add']['interface'] = 'eth0'\n\t>>> sd.dict()\n\t{'ip': {'add': {'interface': 'eth0', 'type': 'shared', 'netmask': '255.255.255.0', 'ip_address': '192.0.2.18'}}}\n\nThe keys in 'add' are unordered, so the XML structure will be:\n\n.. code-block:: xml\n\n\t\n\t\n\t \n\t \n\t eth0\n\t shared\n\t 255.255.255.0\n\t 192.0.2.18\n\t \n\t \n\t\n\nThis packet will return an error because the nodes are not ordered as it should.\nOrdering then are an easy task, just need to use the proper type:\n\n.. code-block:: pycon\n\n\t>>> from pleskapi import StructDict as sd\n\t>>> from pleskapi import odict\n\n\t>>> sd['ip']['add'] = odict()\n\t>>> sd['ip']['add']['ip_address'] = '192.0.2.18'\n\t>>> sd['ip']['add']['netmask'] = '255.255.255.0'\n\t>>> sd['ip']['add']['type'] = 'shared'\n\t>>> sd['ip']['add']['interface'] = 'eth0'\n\t>>> sd.dict()\n\t{'ip': {'add': OrderedDict([('ip_address', '192.0.2.18'), ('netmask', '255.255.255.0'), ('type', 'shared'), ('interface', 'eth0')])}}\n\n`More examples `_\n\n\n\n.. :changelog:\n\nHistory\n-------\n\n0.1.2 (2013-03-10)\n++++++++++++++++++\n\n* Fixed on PyPi again: missing MANIFEST.in\n* Added PleskApiError class on package pleskapi\n* Updated docs and added LICENSE file\n\n\n0.1.1 (2013-03-10)\n++++++++++++++++++\n\n* Fixing on PyPi\n\n\n0.1 (2013-03-10)\n++++++++++++++++++\n\n* Birth",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/sandromello/pypleskapi",
"keywords": "plesk api rpc",
"license": "GNU General Public License",
"maintainer": null,
"maintainer_email": null,
"name": "python-pleskapi",
"package_url": "https://pypi.org/project/python-pleskapi/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/python-pleskapi/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/sandromello/pypleskapi"
},
"release_url": "https://pypi.org/project/python-pleskapi/0.1.2/",
"requires_dist": null,
"requires_python": null,
"summary": "Make easy requests to Parallels Plesk Panel API",
"version": "0.1.2"
},
"last_serial": 798038,
"releases": {
"0.1": [
{
"comment_text": "",
"digests": {
"md5": "ce6553802086947494c342939df97794",
"sha256": "ad138b3f54a8e54ece4f04dd43c5e0908b6fa699a3c1adbadce7c0e8709eeb0b"
},
"downloads": -1,
"filename": "python-pleskapi-0.1.tar.gz",
"has_sig": false,
"md5_digest": "ce6553802086947494c342939df97794",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7089,
"upload_time": "2013-03-10T19:27:14",
"url": "https://files.pythonhosted.org/packages/99/99/74d0482f76e1e3609e52beedc0c1de322e05cd164548ba7cfbb723de9c41/python-pleskapi-0.1.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "b27b1f456c84670164cbe0f8bc7965cb",
"sha256": "2553bba882b0004f2c36de7e19bdb7e9294e6589da9701c94b142cb535e1a804"
},
"downloads": -1,
"filename": "python-pleskapi-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "b27b1f456c84670164cbe0f8bc7965cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7096,
"upload_time": "2013-03-10T19:33:01",
"url": "https://files.pythonhosted.org/packages/27/b5/d4548cdca282b244dd797b05f526d99d08bfa3039483c9766437e5e53bcd/python-pleskapi-0.1.1.tar.gz"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "309a590204876ccafd0f521de84a07c3",
"sha256": "6678d51ca5b30495149b2162c422b77b46f4186fdf775c789f9d59007b6e17cd"
},
"downloads": -1,
"filename": "python-pleskapi-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "309a590204876ccafd0f521de84a07c3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7737,
"upload_time": "2013-03-10T21:01:11",
"url": "https://files.pythonhosted.org/packages/3b/ec/e6e0fbfce7f6627c95cf11c838ee0bee9f229527cf35e530470272705040/python-pleskapi-0.1.2.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "309a590204876ccafd0f521de84a07c3",
"sha256": "6678d51ca5b30495149b2162c422b77b46f4186fdf775c789f9d59007b6e17cd"
},
"downloads": -1,
"filename": "python-pleskapi-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "309a590204876ccafd0f521de84a07c3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7737,
"upload_time": "2013-03-10T21:01:11",
"url": "https://files.pythonhosted.org/packages/3b/ec/e6e0fbfce7f6627c95cf11c838ee0bee9f229527cf35e530470272705040/python-pleskapi-0.1.2.tar.gz"
}
]
}