{ "info": { "author": "Lennart Weiss", "author_email": "lennart.weiss@egym.de", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# lib-freshservice\n\nA wrapper for the [Freshservice](https://egym.freshservice.com) API\nwritten in python3.\n\nProject owner: it-admin@egym.de\n\n## Modules\n\n### api.py\n\nTo do anything useful with the wrapper, you need to import this module. The\nFreshservice API offers various sets of functionality, of those Tickets,\nTasks, Users, Agents and Assets have been implemented. Here you can find a\nclass for each of them. A lot of the API's functionality was not implemented,\nbecause it was not needed. The usage requires basic knowledge about\nFreshservice API usage, you can find the official documentation\n[here](https://api.freshservice.com).\n\n### errors.py\n\nPassing values to the wrapper, that the API doesn't accept, causes the request\nto fail. For developers it can be hard to figure out, what exactly was the\ncause, so this module defines some exceptions and provides logging\nfunctionality.\n\n### models.py\n\nThe API returns JSON, which if it's used in its raw form in code, is not very\npretty. Therefore the response is parsed to objects, which makes working\nwith the data more natural. Some properties have been defined to hide magic\nnumbers. You may need to use those values, when writing to the API,\nso it may be useful to import the constants from this file.\n\n## Examples\n\n### Creating API instances\n\nYou first need to create the general API object, which stores the key.\n```python\n>>> from freshservice.api import API, TicketAPI\n>>> api = API(key, 'domain')\n>>> ticket_api = API(api)\n```\n\nThis can be applied to all other API classes.\n\n### Tickets\n\nHere we will create, update and use a ticket.\n```python\nfrom freshservice.models import Ticket\nsample = ticket_api.create_ticket('Title', 'requester@domain.com',\n due_by='2100-01-01', manual_dueby=True,\n custom_field='Value')\nprint(sample.status)\nprint(sample.custom_field)\nticket_api.update(ticket.display_id, status=Ticket.CLOSED)\n```\nAs you can see in the example, you can use any attribute=value pair, that the\nAPI allows. You can also use custom fields, that you defined for the ticket.\nInternally custom fields have names like 'custom_field_123456' and they are\nin an inner dictionary called 'custom_field'. However this wrapper will rename\nthem and make them directly accessible as seen in the example. This improves\ncode readability a lot.\n\nNote, that the creation of a TicketAPI object will make some API calls, to\nget information about your domain. Therefore it is better to always reuse\nthis object to save API calls.\n\nSome hints: You can't update the description. You will need to create a note\ninstead (APIv2 will bring answer functionality). Working with the API, you\nshould never need to use the Ticket.id field, instead you should use\nTicket.display_id. When you want to update the due date of a ticket, you also\nneed to pass 'manual_dueby=True'.\n\n### Tasks\n\nThe usage of tasks is very similar to tickets, altough they have a bit less\ncomplexity and functionality. The following example assumes, we already have\na ticket object.\n\n```python\nfrom freshservice.models import Task\ntask_list = task_api.get_all_tasks(ticket.display_id)\nfor task in task_list:\n print('{}: {}'.format(task.title, task.description)\n task.update(ticket.display_id, task.id, due_date='2100-01-01')\n```\n\n### Assets\n\nThese are the most complex objects in Freshservice, but the wrapper attempts\nto simplify the usage with automation. To do this, it will make an API call,\nwhen you create the API object. It will also make an additional API\ncall, evertime you create an Asset object of a CI type, that has not been\nused before. To save API calls, you should always reuse an object of AssetAPI.\n\nThis snippet showcases the general usage of the API class:\n\n```python\nfrom models import Asset\nasset = asset_api.search('name', 'pc-123')\nprint(asset)\nasset_api.update(asset.id, impact=Asset.HIGH)\nasset = asset_api.get(asset.id)\n```\n\nThe method 'get_all' is especially risky, because a large database will result\nin a lot of API calls. However it is the only known way, to get all assets\nassigned to a specific user in APIv1. This is an extremely wasteful way of\nusing API calls, therefore an update here from Freshservice is darely needed.\nHowever, this can be done with a relatively small database, so here is an\nexample of how to do this, assuming we only have the email of a user.\n\n```python\nuser = user_api.search('user@domain.com')\nasset_list = asset_api.get_all()\nassigned_hardware = []\nfor asset in asset_list:\n if asset.user_id == user.id:\n assigned_hardware.append(asset)\n```\n\nThis is necessary, because the search function of the API doesn't take the\nuser's email as a parameter. The support of Freshservice promised a solution\nwith APIv2.\n\n### Agents\n\nThis API is currently only usable to get information about a specific agent.\n\n```python\nagent = agent_api.search('agent@domain.com')\nprint(agent)\n```\n\nIf the search fails, the function will raise an Exception.\n\n### Users\n\nThis is analog to agents.\n\n## Things to come\n\nSince this wrapper only implements a subset of the API functionality, there\nwill likely be new API classes introduced, or more methods will be created for\nthe existing classes. Currently Freshservice has released a beta for version 2\nof their API. It will bring better documentation and more functionality,\naswell as more consistency overall.\n\nThe tests right now are poorly organized and don't cover a lot of cases. This\nwill change in the near future, using tox. To make this package more easily\naccessible, it will be released as a package and a Changelog will be introduced.\n\nSome of the code is currently hard to understand, without some deeper knowledge\nof the API's data model, so a seperate document is planned, which explains\nthat a bit, since the official documentation is a bit sparse. The code\ndocumentation in general is subject for improvement.\n\n## License\n\nApache 2.0 - See LICENSE.txt for more information.\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": "https://bitbucket.org/egym-com/freshservice-wrapper/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "freshservice-wrapper", "package_url": "https://pypi.org/project/freshservice-wrapper/", "platform": "", "project_url": "https://pypi.org/project/freshservice-wrapper/", "project_urls": { "Homepage": "https://bitbucket.org/egym-com/freshservice-wrapper/" }, "release_url": "https://pypi.org/project/freshservice-wrapper/1.5/", "requires_dist": [ "requests" ], "requires_python": ">=3", "summary": "An API wrapper for Freshservice", "version": "1.5" }, "last_serial": 4327420, "releases": { "1.1": [ { "comment_text": "", "digests": { "md5": "5e3764b41cb6917ee58c02fdfa835276", "sha256": "1d1a54d330ef3c2454cfc2b65116a01f8b074d4f9d4da5a4506106ff9671a1be" }, "downloads": -1, "filename": "freshservice_wrapper-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5e3764b41cb6917ee58c02fdfa835276", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11803, "upload_time": "2018-06-01T10:01:18", "url": "https://files.pythonhosted.org/packages/85/ea/598894f584a4979c6095c09ad91ae5b83350bed5f3ddf598f1ba780eba14/freshservice_wrapper-1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5307955ec7b9cb57899009ca3e1d26ce", "sha256": "31a59ba6543db49e58e3e12a4ca7154490891ab121edf285badeaddd3c2c2406" }, "downloads": -1, "filename": "freshservice-wrapper-1.1.tar.gz", "has_sig": false, "md5_digest": "5307955ec7b9cb57899009ca3e1d26ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13238, "upload_time": "2018-06-01T10:01:19", "url": "https://files.pythonhosted.org/packages/c9/5e/b2cce55c47f5763f4828eb5b5b8bd1426c4198a4b4bb12fa0df7f444d11d/freshservice-wrapper-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "6a8d56bf76c4f5d567f3ca2f7a5a5509", "sha256": "76f27ade886cfe3d887665801051751aef9b96da7189ef76dbd415c7f693d255" }, "downloads": -1, "filename": "freshservice_wrapper-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6a8d56bf76c4f5d567f3ca2f7a5a5509", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12796, "upload_time": "2018-06-07T10:49:28", "url": "https://files.pythonhosted.org/packages/49/06/776c0050074981644c1b6d9e090d3f65ac7bfd968f0de0ce712e15715420/freshservice_wrapper-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c3ba24a787218daabec4769588692ef8", "sha256": "f2fde53952b71650e360167184d426ed931554b109113e604a365c0aee6f5a6f" }, "downloads": -1, "filename": "freshservice-wrapper-1.2.tar.gz", "has_sig": false, "md5_digest": "c3ba24a787218daabec4769588692ef8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13643, "upload_time": "2018-06-07T10:49:29", "url": "https://files.pythonhosted.org/packages/ab/4c/06c4c4a38fc4f68381ee6b8a19ad37909785d300c13746295606bf5a9da1/freshservice-wrapper-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "6e4b4c1a9da17abe299cab25ca9bfd5b", "sha256": "2164e070b3f463278876e00dd0abb604b0c644a3dd94a5440ce72e4f11e15dde" }, "downloads": -1, "filename": "freshservice_wrapper-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "6e4b4c1a9da17abe299cab25ca9bfd5b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 12819, "upload_time": "2018-06-07T14:30:18", "url": "https://files.pythonhosted.org/packages/3d/4e/3297540bb5f5f6aa3e5c1f48aae9060dfba009e8e5b16f89cc2a86bf72bf/freshservice_wrapper-1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ae07de45f1d33a7909f323f6e8b4006", "sha256": "2caf581e1c5fec133426620ac4efac3be307b99546cc4f8db13b02dd4320958e" }, "downloads": -1, "filename": "freshservice-wrapper-1.3.tar.gz", "has_sig": false, "md5_digest": "0ae07de45f1d33a7909f323f6e8b4006", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 17005, "upload_time": "2018-06-07T14:30:20", "url": "https://files.pythonhosted.org/packages/fb/54/82f3db653d0a2231f144ff7009b21533be8bfaae1e1f78a54189dd183634/freshservice-wrapper-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "d0c50cdd4b033965dec979c4db60f036", "sha256": "55382c5a61dacc2e24be4887084a64b7b21d7dcd4df335a3407970bad125f92d" }, "downloads": -1, "filename": "freshservice_wrapper-1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "d0c50cdd4b033965dec979c4db60f036", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 13423, "upload_time": "2018-10-01T09:25:02", "url": "https://files.pythonhosted.org/packages/8e/00/0054413ea1b02592258eef078b071e6704891a9796d2bfd6a705ab64b2a7/freshservice_wrapper-1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "59de0cc6911e007078c946d8f3ff964c", "sha256": "d8c408419a4c54d65304616654667c4d7a13a095a38df3bf2f28bce25499e2d0" }, "downloads": -1, "filename": "freshservice-wrapper-1.4.tar.gz", "has_sig": false, "md5_digest": "59de0cc6911e007078c946d8f3ff964c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 19291, "upload_time": "2018-10-01T09:25:04", "url": "https://files.pythonhosted.org/packages/c4/f0/c541418a3d2bf4d7bc4bbab7b35a9758f031bb0d16beb35b93f28fa238c1/freshservice-wrapper-1.4.tar.gz" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "07bb8a65c6ca9330705a73d85e2c6a85", "sha256": "ee76856d2e5f528c088cde6e8adee431d015856bbe1fca605b2cf75ee6cc4c3b" }, "downloads": -1, "filename": "freshservice_wrapper-1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "07bb8a65c6ca9330705a73d85e2c6a85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 13442, "upload_time": "2018-10-01T09:43:30", "url": "https://files.pythonhosted.org/packages/a6/5e/427f6dbe6a77561838904ac14aaf7a874af6cd87d0560e27faf4475a8def/freshservice_wrapper-1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c238c49461e025e1d9a03437b6ef95a", "sha256": "679713c2a277565d01a6cd49f18edad4b1d7ec7dc18c69a03daf051ec449670d" }, "downloads": -1, "filename": "freshservice-wrapper-1.5.tar.gz", "has_sig": false, "md5_digest": "9c238c49461e025e1d9a03437b6ef95a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 19319, "upload_time": "2018-10-01T09:43:32", "url": "https://files.pythonhosted.org/packages/c5/4f/2723f71afd897baf99c7aecd62d1506a3984b7423dd16ded9b88cbc42e02/freshservice-wrapper-1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "07bb8a65c6ca9330705a73d85e2c6a85", "sha256": "ee76856d2e5f528c088cde6e8adee431d015856bbe1fca605b2cf75ee6cc4c3b" }, "downloads": -1, "filename": "freshservice_wrapper-1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "07bb8a65c6ca9330705a73d85e2c6a85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 13442, "upload_time": "2018-10-01T09:43:30", "url": "https://files.pythonhosted.org/packages/a6/5e/427f6dbe6a77561838904ac14aaf7a874af6cd87d0560e27faf4475a8def/freshservice_wrapper-1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c238c49461e025e1d9a03437b6ef95a", "sha256": "679713c2a277565d01a6cd49f18edad4b1d7ec7dc18c69a03daf051ec449670d" }, "downloads": -1, "filename": "freshservice-wrapper-1.5.tar.gz", "has_sig": false, "md5_digest": "9c238c49461e025e1d9a03437b6ef95a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 19319, "upload_time": "2018-10-01T09:43:32", "url": "https://files.pythonhosted.org/packages/c5/4f/2723f71afd897baf99c7aecd62d1506a3984b7423dd16ded9b88cbc42e02/freshservice-wrapper-1.5.tar.gz" } ] }