{ "info": { "author": "Doug Ip", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "======\nem7api\n======\n\nAn unofficial Python wrapper for the Science Logic EM7 API\n\nGitHub: https://github.com/dougip/em7api/\n\nPyPI: https://pypi.org/project/em7api/\n\nGetting Started\n===============\n\nInstallation\n------------\n\nInstall from the PyPI repository\n\n\n.. code-block:: python\n\n pip install em7api\n\nPrerequisites\n-------------\n\nThe following are required:\n\n- URI of an existing EM7 portal\n- username\n- password\n\nConfiguration file\n------------------\n\nCreate a file named .em7api located in one of these locations:\n\n- Home directory: ~/.em7api\n- Present working directory: ./.em7api\n\nFile format:\n\n\n.. code-block:: ini\n\n [DEFAULT]\n uri = https://em7.example.com\n username = myEM7user\n password = myEM7password\n\nMore than one environment can be configured by adding additional sections:\n\n\n.. code-block:: ini\n\n [DEFAULT]\n uri = https://em7.example.com\n username = myEM7user\n password = myEM7password\n \n [PRODUCTION]\n uri = https://prod.em7.example.com\n username = prodEM7user\n password = prodEM7user\n\n [DEV]\n uri = https://dev.em7.example.com\n\nUsage\n=====\n\nPassing credentials to the constructor\n--------------------------------------\n\nThe non-default environments can be chosen by passing the environment parameter to the constructor:\n\n\n.. code-block:: python\n\n import em7api\n \n dev_session = em7api.EM7API(environment='DEV', verify_ssl=False)\n\nThe credentials and URI can also be passed as parameters instead of configured in a file:\n\n\n.. code-block:: python\n \n import em7api\n\n session = em7api.EM7API(uri='https://em7.example.com', \\\n username='myEM7user', \\\n password = 'myEM7pass', \\\n verify_ssl=False)\n\nverify_ssl option\n-----------------\n\nIf SSL verification fails, the API call will fail with an SSL error. The easiest way to deal with this is to disable ssl by setting verify_ssl to False when calling the constructor. The verify_ssl value just gets passed to requests's verify value and can be either True, False, or the location of a CA_bundle. This is not disabled by default due to the obvious security implications.\n\n \n.. code-block:: python\n \n import em7api\n\n dev_session = em7api.EM7API(verify_ssl=False)\n\nget\n---\n\nRead operations are done with a get. Doing a get with the URI of a resource will usually return a list of the related objects\n\n\n.. code-block:: python\n\n print session.get('/api/account')\n\n\nEach object will have its own URI, and doing a get on that will return details of that specific object\n\n.. code-block:: python\n \n print session.get('/api/account/1')\n\nlimit parameter\n---------------\n\nBy default, EM7 limits its search to 100. If the data set is greater than that, the limit parameter needs to be specified\n\n\n.. code-block:: python\n \n print session.get('/api/powerpack', parameters={'limit': 200})\n\nFilters\n-------\n\nThe filter parameter can be sent to filter the results. The available filters can be found in the API browser or in the API manual\n\n.. code-block:: python\n \n print session.get('/api/powerpack', parameters={'limit': 1000, \\\n 'filter.0.name.begins_with': 'Science'})\n\nMore than one filter can be added. Each additional filter needs its number incremented.\n\n.. code-block:: python\n \n print session.get('/api/powerpack', parameters={'limit': 1000, \\\n 'filter.0.name.begins_with': 'Science', \\\n 'filter.1.name.contains': 'EM7'})\n\npost\n----\n\nAdding and updating objects is done with a post. The data dictionary contains the details that need to be set for the new or updated object. Whatever is not specified in the data dictionary will mostly be left alone or set to a default value. The following would add a new organization, specifying the company name and leaving the rest blank:\n\n.. code-block:: python\n \n session.post('/api/organization', data={'company': 'My Company'})\n\nTo update an existing object, specify its own URI as the resource, and pass the changes in the data dictionary\n\n.. code-block:: python\n \n session.post('/api/organization/1', data={'company': 'Your Company'})\n\nput\n---\n\nUpdates can also be done with a put. This is more restrictive, as it requires the object to already exist and requires a larger set of the objects' details to be sent in the data dictionary, otherwise it will result in an error.\n\n.. code-block:: python\n \n session.put('/api/organization/1', data={'company': 'Another Company', \\\n 'address': '', \\\n 'city': 'New York', \\\n 'state': 'NY', \\\n 'zip': '', \\\n 'country': 'US', \\\n 'contact_fname': '', \\\n 'contact_lname': '', \\\n 'title': '', \\\n 'dept': '', \\\n 'billing_id': '', \\\n 'crm_id': '', \\\n 'phone': '', \\\n 'fax': '', \\\n 'tollfree': '', \\\n 'email': '', \\\n 'date_create': None, \\\n 'date_edit': '', \\\n 'updated_by': '/api/account/1', \\\n 'theme': '1', \\\n 'longitude': '', \\\n 'latitude': '', \\\n 'notification_append': None})\n\ndelete\n------\n\nObjects can be removed with a delete.\n\n.. code-block:: python\n \n session.delete('/api/organization/1')\n\nAcknowledgments\n===============\n\nThis project relies on the requests module to make the API calls\n\nLicense\n=======\n\nThis project is licensed under the `MIT license`_\n\n.. _`MIT license`: https://github.com/dougip/em7api/blob/master/LICENSE.md", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "em7api", "package_url": "https://pypi.org/project/em7api/", "platform": "", "project_url": "https://pypi.org/project/em7api/", "project_urls": null, "release_url": "https://pypi.org/project/em7api/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "An unofficial Python wrapper for the Science Logic EM7 API", "version": "0.1.4" }, "last_serial": 5219366, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "c74263d9acf9a4c2a3cb921601c3aceb", "sha256": "b62cc0eadd4e22f71f308840670ae56d06dc30d30fb3d334490b0f9027e114e3" }, "downloads": -1, "filename": "em7api-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c74263d9acf9a4c2a3cb921601c3aceb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3240, "upload_time": "2018-03-01T21:19:02", "url": "https://files.pythonhosted.org/packages/68/a0/3fcf3bff9b26f415993595221cc68396daaf92d6989b181558e704c5bfbc/em7api-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "356ed5d8ab6d47bdddc71f5ce3df0f44", "sha256": "0000725d27e2599621c8bd87eef718e09a9ad50599306fe133a98738ca082f78" }, "downloads": -1, "filename": "em7api-0.1.4.tar.gz", "has_sig": false, "md5_digest": "356ed5d8ab6d47bdddc71f5ce3df0f44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3946, "upload_time": "2019-05-02T21:08:48", "url": "https://files.pythonhosted.org/packages/60/80/8d85ccedb45aaceec1ac14ac4a8397d9f46aa33cb44438c201011243a3a9/em7api-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "356ed5d8ab6d47bdddc71f5ce3df0f44", "sha256": "0000725d27e2599621c8bd87eef718e09a9ad50599306fe133a98738ca082f78" }, "downloads": -1, "filename": "em7api-0.1.4.tar.gz", "has_sig": false, "md5_digest": "356ed5d8ab6d47bdddc71f5ce3df0f44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3946, "upload_time": "2019-05-02T21:08:48", "url": "https://files.pythonhosted.org/packages/60/80/8d85ccedb45aaceec1ac14ac4a8397d9f46aa33cb44438c201011243a3a9/em7api-0.1.4.tar.gz" } ] }