{ "info": { "author": "Fabio Castelli", "author_email": "muflone@muflone.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: System :: Networking :: Firewalls" ], "description": "# PyKerio\n\n[![Travis CI Build Status](https://img.shields.io/travis/muflone/pykerio/master.svg)](https://travis-ci.org/muflone/pykerio)\n[![CircleCI Build Status](https://img.shields.io/circleci/project/github/muflone/pykerio/master.svg)](https://circleci.com/gh/muflone/pykerio)\n[![PyPI - Version](https://img.shields.io/pypi/v/PyKerio.svg)](https://pypi.org/project/PyKerio/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/PyKerio.svg)](https://pypi.org/project/PyKerio/)\n[![Coveralls Status](https://img.shields.io/coveralls/github/muflone/pykerio/master.svg)](https://coveralls.io/github/muflone/pykerio?branch=master)\n\n**Description:** API for Kerio products\n\n**Copyright:** 2018 Fabio Castelli (Muflone) \n\n**License:** GPL-2+\n\n**Source code:** https://github.com/muflone/pykerio\n\n**Documentation:** http://www.muflone.com/pykerio/\n\n# Description\n\nPyKerio is an attempt to build a common API to interact with any\n[**Kerio**](https://www.kerio.com/) server in order to operate using external\ntools and simple provisioning scripts.\n\nThe interaction will make use of HTTP requests over the integrated Kerio web\nserver in the same way the classic Kerio Web administration does.\n\n# System Requirements\n\n* Python 3.x\n\n# PyKerio Types\n\nThe original [**Kerio API**](https://manuals.gfi.com/en/kerio/api/index.htm)\ninteracts with the Kerio servers using JSON data but in PyKerio you can find a\nlot of classes to map the JSON raw data to Python objects, in order to ease the\nusage and to check for invalid data types.\n\nThe PyKerio data types are split in 4 groups:\n\n- Simple types\n- Enumerations\n- Structures\n- Lists\n\nAll the PyKerio types can be casted to string or JSON data using\nthe ```.dump()``` method on an instance object.\n\n### PyKerio simple types\n\nThe **PyKerio simple types** can be found in ```pykerio.types``` and are simple\nclasses that map to Python raw data.\n\nThe reason behind the PyKerio simple types is to bound a specific type to some\nfunctions.\nFor example whenever a method requires an ```IpAddress``` type you can instance\na new ```IpAddress``` object which basically wraps a string representing an IPv4\naddress.\n\nTheir usage is rather simple:\n\n >>> ip_address = pykerio.types.IpAddress('8.8.8.8')\n >>> print(ip_address)\n '8.8.8.8'\n\n### PyKerio enumerations\n\nThe **PyKerio enumerations** can be found in ```pykerio.enums``` and are simple\nclasses that refer to a finished set of strings. They can be used in place of\nstrings when a function expects a particular constant value.\n\nThe reason behind the PyKerio Enumerations is to limit the usage of invalid\nstrings and to know the only admitted values for an argument.\nFor example whenever a method requires an ```ActiveTool``` data type you can\ninstance a new ```ActiveTool``` object passing its value during the object\ncreation. This value will be initially checked and invalid values cannot be\nspecified.\n\nTheir usage is shown here:\n\n >>> tool = pykerio.enums.ActiveTool('ActiveToolDns')\n >>> print(tool.dump())\n 'ActiveToolDns'\n\nInvalid arguments cannot be specified during the object creation. The following\ninstructions will raise an AssertionError.\n\n >>> tool = pykerio.enums.ActiveTool('Invalid value')\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"pykerio/enums/BaseEnumeration.py\", line 29, in __init__\n assert(name in self.VALUES)\n AssertionError\n\nIn this way you can safely pass objects to functions without any risk for\ninvalid values as they would be automatically forbidden.\n\n### PyKerio structures\n\nThe **PyKerio Structures** can be found in ```pykerio.structs``` and are complex\nclasses with two or more members.\n\nYou cannot instanciate a PyKerio Structure without expliciting all its members\nvalues. Their usage requires the pass of a dictionary with all its names and\nvalues.\nFor example whenever a function requires you to pass an ```ApiApplication```\nobject you can instance it in this way:\n\n application = pykerio.structs.ApiApplication({\n 'name': 'My application',\n 'vendor': 'Fabio Castelli',\n 'version': '1.1.2'})\n\nSome PyKerio structures can be very complex as they contain a lot of members and\neach member can be another PyKerio structure or a list of many other Python\nstructures.\n\n### PyKerio lists\n\nThe **PyKerio Lists** can be found in ```pykerio.lists``` can be considered as\nlists of a fixed and immutable data types.\n\nThe reason behind the PyKerio lists is to group a list a homogeneous objects of\nthe same type.\n\nFor example whenever a function needs an ```IpAddressList``` object you can\ninstance an ```IpAddressList``` and fill it with as many ```IpAddress``` objects\nyou need.\n\nThere are two ways to fill a PyKerio list with objects:\n\n- At the creation time:\n\n iplist = pykerio.lists.IpAddressList([ip1], [ip2], [ip3])\n\n- After creation:\n\n iplist = pykerio.lists.IpAddressList()\n iplist.append(ip1)\n iplist.append(ip2)\n iplist.append(ip3)\n\nYou cannot put inside a PyKerio list an object of a different type.\n\n# Implemented interfaces\n\nThe following interfaces are implemented under ```pykerio.interfaces```:\n\n- Session\n- HardwareInfo\n- Interfaces\n- Ports\n- FilenameGroups\n- Server\n- Storage\n- IpTools\n\nEvery needed simple type, structure, enumeration or list to implement or use\nthese interfaces it's also present, ready to be used.\n\n# Usage examples\n\nThe very first step to interact with a Kerio server is to instance\na ```PyKerio``` object but the ```PyKerio``` class cannot be directly instanciated\nbut needs to be instanciated through ```PyKerioControl``` or ```PyKerioConnect```\nclasses.\n\nThe next step is to login to the server using valid username and password.\nEvery other commands require a successful login session.\n\nMany usage examples can be found in the ```tests``` folder as they are used\nto test the API operation.\n\n### Login\n\n >>> import pykerio\n >>> import ssl\n >>> ssl._create_default_https_context = ssl._create_unverified_context\n >>> api = pykerio.PyKerioControl(server='control-demo.kerio.com',\n port=4081)\n >>> application = pykerio.structs.ApiApplication({'name': pykerio.APP_NAME,\n 'vendor': pykerio.APP_AUTHOR,\n 'version': pykerio.APP_VERSION})\n >>> session = pykerio.interfaces.Session(api)\n >>> session.login('admin-en', 'kerio', application)\n\n### Logout\n\n >>> session.logout()\n\n\n# What about the missing interfaces?\n\nThe ```PyKerio``` module offers a method called ```request_rpc``` which allows\nyou to launch direct commands to the Kerio server just by providing the method\nname and its input parameters in a JSON array.\n\nAfter a successful login you can interact using the ```request_rpc``` method in\nthe following way:\n\n >>> response = api.request_rpc(method='HardwareInfo.getBoxSerialNumber',\n params={})\n >>> print(response.result)\n {'serialNumber': 'LNKR17123456'}\n\nA more complex example using raw JSON input arguments:\n\n >>> response = api.request_rpc(method='SystemHealth.get',\n params={'type': 'HistogramOneDay'})\n >>> print(response.result['data']['diskTotal'])\n 29239369728\n >>> print(response.result['data']['diskFree'])\n 28010360832\n\nThe same example using the PyKerio ```HistogramType``` class can also be written\nlike this:\n\n >>> from pykerio.enums import HistogramType\n >>> response = api.request_rpc(method='SystemHealth.get',\n params={'type': HistogramType('HistogramOneDay')})\n >>> print(response.result['data']['diskTotal'])\n 29239369728\n >>> print(response.result['data']['diskFree'])\n 28010360832\n\nThe ```request_rpc``` method will automatically convert the PyKerio types\n(from ```pykerio.structs```, ```pykerio.lists```, ```pykerio.enums``` and\n```pykerio.types```) to JSON raw data.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.muflone.com/pykerio/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "PyKerio", "package_url": "https://pypi.org/project/PyKerio/", "platform": "", "project_url": "https://pypi.org/project/PyKerio/", "project_urls": { "Homepage": "http://www.muflone.com/pykerio/" }, "release_url": "https://pypi.org/project/PyKerio/0.4.0/", "requires_dist": null, "requires_python": "", "summary": "API for Kerio products", "version": "0.4.0" }, "last_serial": 4423076, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0c14f6efa1fc511eb6b17752fd03e3ec", "sha256": "5b305f9185001c67ea615f38cfd51356a1b916a3e32b76e6b350339706ce29d1" }, "downloads": -1, "filename": "PyKerio-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0c14f6efa1fc511eb6b17752fd03e3ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17070, "upload_time": "2018-09-09T15:19:29", "url": "https://files.pythonhosted.org/packages/df/6c/e0503d476b465937dca12f1becd71d75c0c0b0f866036f69cf57d71689ee/PyKerio-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8fde451c40317a44075c0833a346171f", "sha256": "8a92d4a52e68b4aadf71df3cc3e01298a062a3939e89520ada3d2357bf6718e2" }, "downloads": -1, "filename": "PyKerio-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8fde451c40317a44075c0833a346171f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26125, "upload_time": "2018-09-09T16:01:42", "url": "https://files.pythonhosted.org/packages/51/de/f52a6c665df921edfa1f4829889568693b80f3ea62fb21b43c6599a93bb5/PyKerio-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "75afb5c7671f37f033d5e26ab532f105", "sha256": "ac716b588f4ac94a15d15e89b7bd929bb447c6fb8f57d6e03ff2e7444ade1ba0" }, "downloads": -1, "filename": "PyKerio-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "75afb5c7671f37f033d5e26ab532f105", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17240, "upload_time": "2018-09-16T12:16:49", "url": "https://files.pythonhosted.org/packages/fc/90/e57a6eca3a8d92bd2df3be8bcefddb7a2a1e07a933b36eb0ebd3fa098054/PyKerio-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ce6754cba248df3ce0cc7a61d739642", "sha256": "9c9db48369b97e4358fd4e434057ed4af15173214a9b8b86393c6fcad2046d32" }, "downloads": -1, "filename": "PyKerio-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9ce6754cba248df3ce0cc7a61d739642", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27646, "upload_time": "2018-09-16T12:16:52", "url": "https://files.pythonhosted.org/packages/b7/f2/f60cb40ef4f497f6de106b321d6fe74367a65729e41d09f63fafa5713535/PyKerio-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "285d91ecb610d18936929428605a28e7", "sha256": "22133a4e72c634d16cd1faacb801b0d669c2a39534e47ba9cad293d299f48615" }, "downloads": -1, "filename": "PyKerio-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "285d91ecb610d18936929428605a28e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 195673, "upload_time": "2018-10-20T21:43:58", "url": "https://files.pythonhosted.org/packages/16/80/25819a530ac0e094997e4897e5ef96c849205ed3183c79c73ec9c82606c4/PyKerio-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b82a5a18ed8c3fb8fa4394c35f7fa7f2", "sha256": "89c24a655e766786d0bae58916e0e7709eb90814a0c6ab7c87b35d1b9537daa4" }, "downloads": -1, "filename": "PyKerio-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b82a5a18ed8c3fb8fa4394c35f7fa7f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 88667, "upload_time": "2018-10-20T21:44:01", "url": "https://files.pythonhosted.org/packages/16/fd/67c682fced6dd6bba1178a93055883f051019e95f4de5728a945a2456e7e/PyKerio-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "0077ac915c2b7ce5d62986bfabcf84b7", "sha256": "09e769ae6762b896cac701b8b56fc70d6df5da4ce142591ecadadac5deefea9e" }, "downloads": -1, "filename": "PyKerio-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0077ac915c2b7ce5d62986bfabcf84b7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 207143, "upload_time": "2018-10-21T21:45:53", "url": "https://files.pythonhosted.org/packages/db/31/6f740a51a773e1c0f80343251d2b3ddc6fd4010a62f67bbbe046b395a054/PyKerio-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ad46ad7916ea969ec58e69c964e3916", "sha256": "6b2788ae114931fa601eb5ba497606c81094f5ab0bb79119679a84f971bba36a" }, "downloads": -1, "filename": "PyKerio-0.3.0.tar.gz", "has_sig": false, "md5_digest": "2ad46ad7916ea969ec58e69c964e3916", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 78931, "upload_time": "2018-10-21T21:45:55", "url": "https://files.pythonhosted.org/packages/ca/44/00f91fe901f8af99ed79c2e14a2fd022c6e98fde67efeec2a735029f211e/PyKerio-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "2617d77a3b793caae5cec55e46ed20e4", "sha256": "81dd405bfeef0689bebe8b7b3a3389f07c13c210db9ec7ac7ed529ec48b98fda" }, "downloads": -1, "filename": "PyKerio-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2617d77a3b793caae5cec55e46ed20e4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 208455, "upload_time": "2018-10-27T22:51:34", "url": "https://files.pythonhosted.org/packages/91/c3/bbbfa2938abe857f2a3f75c74c42755e2c9ec8bf0a44cb5553f65c9a9dd5/PyKerio-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7231ac168485e644b3be2bf97bedc8d5", "sha256": "5749b7a93548a8de916de9884d856e2cdf5933bf4278917c5fd74af7a7cfe652" }, "downloads": -1, "filename": "PyKerio-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7231ac168485e644b3be2bf97bedc8d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 80023, "upload_time": "2018-10-27T22:51:37", "url": "https://files.pythonhosted.org/packages/64/f5/6b734ab20871dc9a9589ba3a703682e7bad81be8b793527cd0fdb47a50bf/PyKerio-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2617d77a3b793caae5cec55e46ed20e4", "sha256": "81dd405bfeef0689bebe8b7b3a3389f07c13c210db9ec7ac7ed529ec48b98fda" }, "downloads": -1, "filename": "PyKerio-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "2617d77a3b793caae5cec55e46ed20e4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 208455, "upload_time": "2018-10-27T22:51:34", "url": "https://files.pythonhosted.org/packages/91/c3/bbbfa2938abe857f2a3f75c74c42755e2c9ec8bf0a44cb5553f65c9a9dd5/PyKerio-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7231ac168485e644b3be2bf97bedc8d5", "sha256": "5749b7a93548a8de916de9884d856e2cdf5933bf4278917c5fd74af7a7cfe652" }, "downloads": -1, "filename": "PyKerio-0.4.0.tar.gz", "has_sig": false, "md5_digest": "7231ac168485e644b3be2bf97bedc8d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 80023, "upload_time": "2018-10-27T22:51:37", "url": "https://files.pythonhosted.org/packages/64/f5/6b734ab20871dc9a9589ba3a703682e7bad81be8b793527cd0fdb47a50bf/PyKerio-0.4.0.tar.gz" } ] }