{ "info": { "author": "apsconnect team, original by oznu", "author_email": "aps@odin.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "osaAPI\n=====\n![pyversions](https://img.shields.io/pypi/pyversions/osaapi.svg) [![Build Status](https://img.shields.io/travis/ingrammicro/osaAPI/master.svg)](https://travis-ci.org/ingrammicro/osaAPI) [![PyPi Status](https://img.shields.io/pypi/v/osaapi.svg)](https://pypi.python.org/pypi/osaapi)\n\n\nA python binding for the Odin Service Automation (OSA) and billing APIs.\n\nInstallation\n------------\n\nUsing pip:\n\n $ pip install osaAPI\n\nConnecting and Authenticating\n-----------------------------\n\n``` {.sourceCode .python}\nOSA(host,user=None,password=None,ssl=False,verbose=False,port=8440)\n\nPBA(host,user=None,password=None,ssl=False,verbose=False,port=5224)\n```\n\n### Default Connection\n\n``` {.sourceCode .python}\nfrom osaapi import OSA, PBA\n\n# connect to OSA\npem = OSA('mn.hostname.com')\n\n# connect to PBA\napi = PBA('pba.hostname.com')\n```\n\n### Basic HTTP Authentication\n\n``` {.sourceCode .python}\nfrom osaapi import OSA, PBA\n\n# connect to OSA \npem = OSA('mn.hostname.com', user='admin', password='setup')\n```\n\n### SSL\n\n``` {.sourceCode .python}\nfrom osaapi import OSA, PBA\n\n# connect to OSA \npem = OSA('mn.hostname.com', ssl=True)\n```\n\n### Custom Port\n\n``` {.sourceCode .python}\nfrom osaapi import OSA, PBA\n\n# connect to OSA \npem = OSA('mn.hostname.com', port=8888)\n```\n\nOdin Service Automation (OSA) API\n-----------------------------------------\n\nAll but three of the OSA API calls start with 'pem', for this reason it\nis recommended you name your OSA connection object 'pem' so you can call\nfunctions exactly how they are documented in the OSA API as has been\ndone in the examples in this Readme.\n\nThe full OSA Public API Reference can be found here:\n\n\n\n### Basic API Call\n\nThis example will show the\n[pem.getAccountInfo](http://download.automation.odin.com/oa/7.1/oapremium/portal/en/operations_api_reference/7915.htm)\nmethod being called.\n\n``` {.sourceCode .python}\nfrom osaapi import OSA\n\npem = OSA('mn.hostname.com')\n\nd = {\n 'account_id' : 1002242\n}\n\nprint pem.getAccountInfo(**d)\n\n# {'status': 0, 'result': {'fax': {'phone_num': '', 'ext_num': '', 'area_code': '', 'country_code': ''}, 'account_type': 'C', 'phone': {'phone_num': '00000000', 'ext_num': '', 'area_code': '04', 'country_code': '61'}, 'brand': {'brand_id': 191, 'domain_name': 'brandingdomain.com', 'name': 'brandname'}, 'email': 'noreply@example.com', 'person': {'first_name': 'John', 'last_name': 'Smith', 'middle_name': '', 'company_name': 'Test Account', 'title': ''}, 'address': {'city': 'Canberra', 'country': 'au', 'street_name': '1 Test Street', 'zipcode': '2621', 'state': 'ACT', 'house_num': '', 'address2': ''}, 'parent_account_id': 1002241}}\n```\n\n### API Call with 'array of struct'\n\nThe OSA API often calls for values and settings to be sent as an 'array\nof struct'. This example shows how to send these values using the osaapi\nclient.\n\nThis example is based on the\n[pem.activateSubscription](http://download.automation.odin.com/oa/7.1/oapremium/portal/en/operations_api_reference/39160.htm)\nmethod with resources types called 'DiskSpace' and 'Bandwidth' and a\ndomain name.\n\n``` {.sourceCode .python}\nfrom osaapi import OSA\n\npem = OSA('mn.hostname.com')\n\n# define the resource limits:\nDiskSpace = {\n \"resource_id\" : 1002486,\n \"resource_limit\" : 1024\n}\nBandwidth = {\n \"resource_id\" : 1002487,\n \"resource_limit\" : -1\n}\n\n# define the paramaters:\nDomainName = {\n \"var_name\" : \"DomainID\",\n \"var_value\" : \"example.com.au\"\n}\n\n# setup the call:\nd = {\n \"account_id\" : 1002242,\n \"subscription_name\" : \"Hosting (example.com.au)\",\n \"subscription_id\" : 1006754,\n \"service_template_id\" : 204,\n \"resource_limits\" : [DiskSpace, Bandwidth],\n \"paramaters\" : [DomainName],\n}\n\n# execute the call:\nresult = pem.activateSubscription(**d)\n```\n\n### Transactions\n\n\n\nThere are three OSA API calls that do not start with pem in the official\ndocumentation. When using osaapi you can use these API calls as\ndocumented but you will still need to prefix them with your OSA\nconnection object (the examples on this page use 'pem' as the connection\nobject name).\n\n``` {.sourceCode .python}\nfrom osaapi import OSA\n\npem = OSA('mn.hostname.com')\n\n# being transaction\npem.txn.Begin()\n\n# commit transaction\npem.txn.Commit()\n\n# rollback transaction\npem.txn.Rollback()\n```\n\n### Error Handling\n\n\nThe OSA API has quite good responses when an error occurs during an API\ncall. The below example shows the response format for OSA API errors:\n\n``` {.sourceCode .python}\n{\n 'status' : -1, \n 'extype_id' : 21, \n 'module_id' : 'OpenAPI', \n 'error_message' : 'Invalid set of arguments. There should be specified EITHER external_info OR person, address, phone, [fax], [locale], email.', \n 'properties' : { \n 'reason': 'Invalid set of arguments. There should be specified EITHER external_info OR person, address, phone, [fax], [locale], email.'\n }\n}\n```\n\nBilling module API\n---------------------------------------\n\nThe billing API is quite different from the OSA API, and not quite as user\nfriendly. The osaapi client makes using the billing a little easier by\nstandardizing the returned responses, providing status codes, and\ndecoding any error messages.\n\nThe major difference between the OSA and billing api is how values are sent\nand received. In billing params are sent and responses are received as a\nlist in a specific order to know what each value represents.\n\nThe full billing Public API Reference can be found here:\n\n\n\n### Basic API Call\n\nThis example will show the **AccountDetailsGet\\_API** method being\ncalled.\n\n``` {.sourceCode .python}\nfrom osaapi import PBA\n\napi = PBA('pba.hostname.com')\n\nprint api.Execute('AccountDetailsGet_API', params=['1002242'])\n\n# {'status': 0, 'result': [1002242, 1002241, 'Test Account 5543', '1 Test Street', '', 'Canberra', '', '2621', 'au', '', 'John', 'D', 'Smith', 'noreply@example.com', '61', '04', '000000000', '', '', '', '', '', 1351787114, 2, 0]}\n```\n\n### Alternate Server\n\nMost billing API method calls use the \"BM\" server. Some methods use\nalternate servers such as \"PEMGATE\" or \"DOMAINGATE\". This example shows\nhow to specify an alternate server:\n\n``` {.sourceCode .python}\nfrom osaapi import PBA\n\napi = PBA('pba.hostname.com')\n\napi.Execute('DomainExpirationDateGet_API', params=params, server='DOMAINGATE')\n```\n\n### Error Handling\n\nosaapi takes the way OSA returns errors natively and applies it to the\nbilling API. The status on each responce will either be **0** for a\nsuccesfull call, or **-1** if billing returned an error.\n\nThis is an example of what is returned in the case of an error:\n\n``` {.sourceCode .python}\n{\n 'status' : -1, \n 'error_message' : 'Table Account does not contain row with ID 99999999.', \n 'server' : 'BM', \n 'host' : 'pba.hostname.com', \n 'params' : ['99999999'], \n 'result' : None, \n 'method' : 'AccountDetailsGet_API'\n}\n```", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://aps.odin.com", "keywords": "", "license": "Apache License", "maintainer": "", "maintainer_email": "", "name": "osaapi", "package_url": "https://pypi.org/project/osaapi/", "platform": "", "project_url": "https://pypi.org/project/osaapi/", "project_urls": { "Homepage": "https://aps.odin.com" }, "release_url": "https://pypi.org/project/osaapi/0.4.4/", "requires_dist": null, "requires_python": "", "summary": "A python binding for the Odin Service Automation (OSA) and billing APIs.", "version": "0.4.4" }, "last_serial": 3100570, "releases": { "0.3.10": [ { "comment_text": "", "digests": { "md5": "0bfb99b6dd5bf1955ecc127ee7dfbf58", "sha256": "735a33a099b9988d0b7c7af8afc1fc3743676680690f6f344350221d56496903" }, "downloads": -1, "filename": "osaapi-0.3.10.tar.gz", "has_sig": false, "md5_digest": "0bfb99b6dd5bf1955ecc127ee7dfbf58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10990, "upload_time": "2017-01-10T17:46:08", "url": "https://files.pythonhosted.org/packages/8a/fa/f00fdf1b3aef16afe230606305407ec569c1d00584777910933ec86bc584/osaapi-0.3.10.tar.gz" } ], "0.3.11": [ { "comment_text": "", "digests": { "md5": "a4c59f17e02c23dac2dab6e14e88bc29", "sha256": "1ecb052060eea8cfd3463b71ef11a405ed6c2df7de91d63b9c53339eeae12b87" }, "downloads": -1, "filename": "osaapi-0.3.11.tar.gz", "has_sig": false, "md5_digest": "a4c59f17e02c23dac2dab6e14e88bc29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10984, "upload_time": "2017-03-14T11:34:50", "url": "https://files.pythonhosted.org/packages/67/ea/49ff1ea1a05b67deed74545835584eb8b9d30fce24150d178369dc7ffaf0/osaapi-0.3.11.tar.gz" } ], "0.3.12": [ { "comment_text": "", "digests": { "md5": "f48e4dd4d12596ff77fbe1974e04f09f", "sha256": "f01beae6a5444bc53b822d12cdc478e9c96708d8ff399e30d84605b577e02af7" }, "downloads": -1, "filename": "osaapi-0.3.12.tar.gz", "has_sig": false, "md5_digest": "f48e4dd4d12596ff77fbe1974e04f09f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10985, "upload_time": "2017-03-14T11:35:47", "url": "https://files.pythonhosted.org/packages/e0/ed/b99a1dab40a395982687258106ceb7ae81b3873325feb236975f6ee975a2/osaapi-0.3.12.tar.gz" } ], "0.3.5": [ { "comment_text": "", "digests": { "md5": "f81da229dc78db944a437e9e58d5bc1d", "sha256": "a7c7e59ab6161f18a7a7d624bbd757416d385b4fe6859b9ae305dfbeea2bbc79" }, "downloads": -1, "filename": "osaapi-0.3.5.tar.gz", "has_sig": false, "md5_digest": "f81da229dc78db944a437e9e58d5bc1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10430, "upload_time": "2016-06-06T09:14:14", "url": "https://files.pythonhosted.org/packages/70/14/8c3143187ed89ccd91221a9bdca5107217463d4320ce255efafa749e987f/osaapi-0.3.5.tar.gz" } ], "0.3.7": [ { "comment_text": "", "digests": { "md5": "6f6df83c0bc28147435e6a00662244e6", "sha256": "a4c832ae20b7b3286e71e9b69ad91559971203839ba47f0015ac2ab005d7f6fc" }, "downloads": -1, "filename": "osaapi-0.3.7.tar.gz", "has_sig": false, "md5_digest": "6f6df83c0bc28147435e6a00662244e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10879, "upload_time": "2016-06-07T07:13:58", "url": "https://files.pythonhosted.org/packages/e7/fa/852857a1b57fade48e09e41157dd0068ae55787b227e5d732fbd27a62efb/osaapi-0.3.7.tar.gz" } ], "0.3.8": [ { "comment_text": "", "digests": { "md5": "82ef73c2bbde2ff61d532d6153bffa47", "sha256": "c26154e003cc256f5626c560e41ad5094a45b5d0e1523f61c2d26db36b530052" }, "downloads": -1, "filename": "osaapi-0.3.8.tar.gz", "has_sig": false, "md5_digest": "82ef73c2bbde2ff61d532d6153bffa47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10929, "upload_time": "2016-06-24T15:25:02", "url": "https://files.pythonhosted.org/packages/f9/85/eee50ebbb8c4cec60952e338a21232b0b34c73f8bdbf4ceb05bdbca53668/osaapi-0.3.8.tar.gz" } ], "0.3.9": [ { "comment_text": "", "digests": { "md5": "691c82a4c27582ddf1b4aebde95dd773", "sha256": "d9077f9da4d72343f53d753f7555f4a34b87beb8fd9a373b66036add630c52d7" }, "downloads": -1, "filename": "osaapi-0.3.9.tar.gz", "has_sig": false, "md5_digest": "691c82a4c27582ddf1b4aebde95dd773", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10926, "upload_time": "2016-10-16T19:04:03", "url": "https://files.pythonhosted.org/packages/09/f4/9e91954d486b14d43afcf0bf20ec182697f03032eeab9ee43180880f1c37/osaapi-0.3.9.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "dad75d0764f1e3cfb7d0b27d1f6ed889", "sha256": "4f40cc7543344bde209ac63ad588376d407e84d8350467d941e666578c464f84" }, "downloads": -1, "filename": "osaapi-0.4.2.tar.gz", "has_sig": false, "md5_digest": "dad75d0764f1e3cfb7d0b27d1f6ed889", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11097, "upload_time": "2017-05-31T21:32:22", "url": "https://files.pythonhosted.org/packages/9e/12/8b32e30c0891ddaa6c539addafe07ddb585329aa11fb566e409a4a8ae7cd/osaapi-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "4cbf0cb355e5a8db71892dd896277626", "sha256": "c33811a1e5fe0574bebc87fbc4368b8217c68f1dcab77c72404e725972e7b960" }, "downloads": -1, "filename": "osaapi-0.4.3.tar.gz", "has_sig": false, "md5_digest": "4cbf0cb355e5a8db71892dd896277626", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11132, "upload_time": "2017-08-10T13:16:35", "url": "https://files.pythonhosted.org/packages/05/e8/7c20f90a42734babd11f3de7c1d84aaa3e16ddfcd7c1ace1886d18aa73a6/osaapi-0.4.3.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "8d6e4b96123f80b3e95d4de9d5154b9c", "sha256": "7953e28c0653f5d12b4e94b4b37a343926d07cee61ded4bcda02977da4c425b2" }, "downloads": -1, "filename": "osaapi-0.4.4.tar.gz", "has_sig": false, "md5_digest": "8d6e4b96123f80b3e95d4de9d5154b9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11130, "upload_time": "2017-08-16T12:13:13", "url": "https://files.pythonhosted.org/packages/e4/f3/af6799c5cb2e0f5f719c2fcb57fbe8109129183cf379d899e67e0e09d5dd/osaapi-0.4.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d6e4b96123f80b3e95d4de9d5154b9c", "sha256": "7953e28c0653f5d12b4e94b4b37a343926d07cee61ded4bcda02977da4c425b2" }, "downloads": -1, "filename": "osaapi-0.4.4.tar.gz", "has_sig": false, "md5_digest": "8d6e4b96123f80b3e95d4de9d5154b9c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11130, "upload_time": "2017-08-16T12:13:13", "url": "https://files.pythonhosted.org/packages/e4/f3/af6799c5cb2e0f5f719c2fcb57fbe8109129183cf379d899e67e0e09d5dd/osaapi-0.4.4.tar.gz" } ] }