{ "info": { "author": "Erwin Sterrenburg", "author_email": "e.w.sterrenburg@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Office/Business", "Topic :: Software Development :: Bug Tracking" ], "description": "Python-OTRS : Python wrapper to OTRS SOAP API\r\n=============================================\r\n\r\nLet you access the OTRS API a pythonic-way.\r\n\r\nFeatures\r\n--------\r\n\r\n- Implements fully communication with the ``GenericTicketConnectorSOAP`` and ``GenericFAQConnectorSOAP``\r\n provided as webservice example by OTRS;\r\n- Dynamic fields and attachments are supported;\r\n- Authentication is handled programmatically, per-request or per-session;\r\n- Calls are wrapped in OTRSClient methods;\r\n- OTRS XML objects are mapped to Python-style objects.\r\n\r\nTo be done\r\n----------\r\n\r\n- Test for python3 compatibility and make resulting changes;\r\n- Improve and extend ``tests.py``.\r\n\r\nCompatibility\r\n--------\r\n- Python 2.7;\r\n- Python 3.5;\r\n\r\nInstall\r\n-------\r\n\r\n::\r\n\r\n pip install python-otrs\r\n\r\nTicket and Session Operations\r\n-----------------------------\r\n\r\nFirst make sure you installed the ``GenericTicketConnectorSOAP`` webservice,\r\nsee `official documentation`_. The file GenericTicketConnectorSOAP.yml can be downloaded\r\nonline as the basis for this service.\r\n\r\nNote: in older versions of OTRS, GenericTicketConnectorSOAP was called GenericTicketConnector\r\n\r\n::\r\n\r\n from otrs.ticket.template import GenericTicketConnectorSOAP\r\n from otrs.client import GenericInterfaceClient\r\n from otrs.ticket.objects import Ticket, Article, DynamicField, Attachment\r\n\r\n server_uri = r'https://otrs.example.net'\r\n webservice_name = 'GenericTicketConnectorSOAP'\r\n client = GenericInterfaceClient(server_uri, tc=GenericTicketConnectorSOAP(webservice_name))\r\n\r\nThen authenticate, you have three choices :\r\n\r\n::\r\n\r\n # user session\r\n client.tc.SessionCreate(user_login='login', password='password')\r\n\r\n # customer_user session\r\n client.tc.SessionCreate(customer_user_login='login' , password='password')\r\n\r\n # save user in memory\r\n client.register_credentials(user='login', password='password')\r\n\r\nPlay !\r\n\r\nCreate a ticket :\r\n\r\n::\r\n\r\n import mimetypes\r\n import base64\r\n\r\n t = Ticket(State='new', Priority='3 normal', Queue='Support',\r\n Title='Problem test', CustomerUser='foo@example.fr',\r\n Type='Divers')\r\n a = Article(Subject='UnitTest', Body='bla', Charset='UTF8',\r\n MimeType='text/plain')\r\n df1 = DynamicField(Name='TestName1', Value='TestValue1')\r\n df2 = DynamicField(Name='TestName2', Value='TestValue2')\r\n att_path = r'C:\\Temp\\image001.png'\r\n mimetype = mimetypes.guess_type(att_path)[0]\r\n att_file = open(att_path , 'rb')\r\n att_content = base64.b64encode(att_file.read())\r\n att1 = Attachment(Content=att_content,\r\n ContentType=mimetype, Filename=\"image001.png\")\r\n att_file.close()\r\n\r\n t_id, t_number = client.tc.TicketCreate(t, a, [df1, df2], [att1])\r\n\r\nUpdate an article :\r\n\r\n::\r\n\r\n # changes the title of the ticket\r\n t_upd = Ticket(Title='Updated ticket')\r\n client.tc.TicketUpdate(t_id, ticket=t_upd)\r\n\r\n # appends a new article (attachments optional)\r\n new_article = Article(Subject='More info', Body='blabla', Charset='UTF8',\r\n MimeType='text/plain')\r\n client.tc.TicketUpdate(article=new_article, attachments=None)\r\n\r\nSearch for tickets :\r\n\r\n::\r\n\r\n # returns all the tickets of customer 42\r\n tickets = client.tc.TicketSearch(CustomerID=42)\r\n\r\n # returns all tickets in queue Support\r\n # for which Dynamic Field 'Project' starts with 'Pizza':\r\n df2 = DynamicField(Name='Project', Value='Pizza%', Operator=\"Like\")\r\n client.tc.TicketSearch(Queues='Support', dynamic_fields=[df_search])\r\n\r\nRetrieve a ticket :\r\n\r\n::\r\n\r\n ticket = client.tc.TicketGet(138, get_articles=True, get_dynamic_fields=True, get_attachments=True)\r\n article = ticket.articles()[0]\r\n article.save_attachments(r'C:\\temp')\r\n\r\nMany options are possible with requests, you can use all the options\r\navailable in `official documentation`_.\r\n\r\n.. _official documentation: http://otrs.github.io/doc/manual/admin/4.0/en/html/genericinterface.html#generic-ticket-connector\r\n\r\nPublic FAQ Operations\r\n---------------------\r\n\r\nFirst, make sure you have installed the open-source FAQ add-on module into your OTRS system and added the\r\nGenericFAQConnectorSOAP web service by installing the GenericFAQConnector.yml file.\r\n\r\n::\r\n\r\n from otrs.ticket.template import GenericTicketConnectorSOAP\r\n from otrs.faq.template import GenericFAQConnectorSOAP\r\n from otrs.client import GenericInterfaceClient\r\n\r\n client = GenericInterfaceClient('https://otrs.mycompany.com', tc=GenericTicketConnectorSOAP('GenericTicketConnectorSOAP'), fc=GenericFAQConnectorSOAP('GenericFAQConnectorSOAP'))\r\n\r\n # first, establish session with the TicketConnector\r\n client.tc.SessionCreate(user_login='someotrsuser', password='p4ssw0rd')\r\n\r\nList FAQ Languages:\r\n\r\n::\r\n\r\n langlist = client.fc.LanguageList()\r\n for language in langlist:\r\n print language.ID, language.Name\r\n\r\nList FAQ Categories that have Public FAQ items in them:\r\n\r\n::\r\n\r\n catlist = client.fc.PublicCategoryList()\r\n for category in catlist:\r\n print category.ID, category.Name\r\n\r\nRetrieve a public FAQ article by ID\r\n(note: FAQ Item ID is not the same as the item number!)\r\n\r\n::\r\n\r\n # retrieves FAQ item ID #190 with attachment contents included\r\n myfaqitem = client.fc.PublicFAQGet(190, get_attachments=True)\r\n # print the FAQ's Problem field\r\n print myfaqitem.Field2\r\n\t# saves attachments to folder ./tempattach\r\n myfaqitem.save_attachments('./tempattach')\r\n\r\nSearch for an FAQ article\r\n\r\n::\r\n\r\n #find all FAQ articles with Windows in title:\r\n\tresults = client.fc.PublicFAQSearch(Title='*Windows*')\r\n\tfor faqitemid in results:\r\n\t print \"Found FAQ item ID containing Windows: \" + str(faqitemid)\r\n\r\n\r\nCustom Web Service Connectors\r\n-----------------------------\r\n\r\nFor the FAQ operations above, note that we still needed the Ticket connector to provide access\r\nto the SessionCreate method. However, if your application only needs to work with FAQ articles\r\nand not tickets, you may wish to create a custom web service in OTRS that not only includes\r\nthe four FAQ operations but also includes the SessionCreate operation to allow you to establish\r\na session. This is very easy to accommodate in python-otrs.\r\n\r\nFirst, in OTRS, do the following:\r\n\r\n1. In OTRS Admin->Web Services, add a new web service without using a .yml file. Name it something\r\n like 'ImprovedFAQConnectorSOAP'. \r\n2. In the settings for the web service, set the transport to HTTP::SOAP\r\n3. Click Save\r\n4. Click the 'Configure' button that has appeared next to HTTP::SOAP\r\n5. Set the namespace name to whatever you want (ex. http://www.otrs.org/FAQConnector).\r\n6. Enter the maximum message length you want (normally 10000000)\r\n7. Save the changes and go back to the main web service configuration screen.\r\n8. Add the operations you want to your custom webservice. For instance, for our improved FAQConnector,\r\n you might add the four FAQ Operations and also the SessionCreate operation.\r\n9. Save your webservice\r\n\r\nNow that we have a web service in OTRS, we can use our custom web service in python-otrs. To do this,\r\nfirst create a 'template' for your new ImprovedFAQConnectorSOAP. Specify the namespace name assigned\r\nin step 5 above as the second parameter to the WebService() call.\r\n\r\n::\r\n\r\n from otrs.faq.operations import LanguageList,PublicCategoryList,PublicFAQGet,PublicFAQSearch\r\n from otrs.session.operations import SessionCreate\r\n from otrs.client import WebService\r\n\r\n def ImprovedFAQConnectorSOAP(webservice_name='ImprovedFAQConnectorSOAP'):\r\n return WebService(webservice_name, 'http://www.otrs.org/FAQConnector', SessionCreate=SessionCreate(), LanguageList=LanguageList(),PublicCategoryList=PublicCategoryList(),PublicFAQGet=PublicFAQGet(),PublicFAQSearch=PublicFAQSearch())\r\n\r\nNow, use your improved FAQ connector:\r\n\r\n::\r\n\r\n from otrs.client import GenericInterfaceClient\r\n\r\n client = GenericInterfaceClient('https://otrs.mycompany.com', impfaqc=ImprovedFAQConnectorSOAP('ImprovedFAQConnectorSOAP'))\r\n\r\n # first, establish session\r\n client.impfaqc.SessionCreate(user_login='someotrsuser', password='p4ssw0rd')\r\n\r\n\t# get an FAQ item:\r\n\tclient.impfaqc.PublicFAQGet(190)\r\n\r\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ewsterrenburg/python-otrs", "keywords": "otrs ticket support soap interface helpdesk", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "python-otrs", "package_url": "https://pypi.org/project/python-otrs/", "platform": "", "project_url": "https://pypi.org/project/python-otrs/", "project_urls": { "Homepage": "https://github.com/ewsterrenburg/python-otrs" }, "release_url": "https://pypi.org/project/python-otrs/0.4.3/", "requires_dist": [ "defusedxml" ], "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "summary": "A programmatic interface to OTRS SOAP API.", "version": "0.4.3" }, "last_serial": 3112440, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4431651df8a3657ef72cbe960f07ed9d", "sha256": "e9004566503af633a67510c81502d3f4e9007ad5d897ffcef7209d884d33459a" }, "downloads": -1, "filename": "python_otrs-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4431651df8a3657ef72cbe960f07ed9d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10371, "upload_time": "2015-09-03T17:35:31", "url": "https://files.pythonhosted.org/packages/d0/28/4a08de7412f0891890d9de9724055da5bc49b6ff801568c6ecb33dcb940b/python_otrs-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b393583301a1e2bb05e3c80318cc9e8", "sha256": "c1c3dcf12097470272368e07fb0bf4133d78c6b182181638da5968f1469203fa" }, "downloads": -1, "filename": "python-otrs-0.1.0.zip", "has_sig": false, "md5_digest": "4b393583301a1e2bb05e3c80318cc9e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12913, "upload_time": "2015-09-03T17:33:57", "url": "https://files.pythonhosted.org/packages/f7/11/a8f85b60612da715fe7aa0b9c161be1d37d5333d60b3b8eda4c458b3c6d2/python-otrs-0.1.0.zip" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9ea90da40d6a0efe1abdee1ec384e52e", "sha256": "31494f0d29f77dc28b22dcf12a7a733c68640ae5869b96200700cf1e798cbf53" }, "downloads": -1, "filename": "python-otrs-0.2.0.zip", "has_sig": false, "md5_digest": "9ea90da40d6a0efe1abdee1ec384e52e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13500, "upload_time": "2016-08-01T09:43:01", "url": "https://files.pythonhosted.org/packages/81/57/86ae4d019dcd88b3efddea63cb192538a1b795c34c70a0aa873aa66fb66f/python-otrs-0.2.0.zip" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "7b265f97df57067152ad8d0100f8a421", "sha256": "069f839f94c5be0d3572d77e843b9fdaef9e4410d67449263dec4c0a5fee0e9a" }, "downloads": -1, "filename": "python-otrs-0.3.0.zip", "has_sig": false, "md5_digest": "7b265f97df57067152ad8d0100f8a421", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23640, "upload_time": "2016-08-01T09:52:39", "url": "https://files.pythonhosted.org/packages/c0/e6/7ef87419e62bfd37460813df4b17305020b1578625d53ecdf88ae4297a77/python-otrs-0.3.0.zip" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "66d13fd8eb20205695e8a6cb7695ff21", "sha256": "a584b2bbc7fd63dcc4e3c82f0a5d4cd5f1d57f590f902b917e56cf3a45598261" }, "downloads": -1, "filename": "python_otrs-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "66d13fd8eb20205695e8a6cb7695ff21", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 19674, "upload_time": "2017-08-21T14:28:07", "url": "https://files.pythonhosted.org/packages/b4/47/bd21a0373a596c0221599c92457823b5255cb4e804320bdcfff55d9e427d/python_otrs-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5fd0bd3bca1102609da4c3a30874b2bb", "sha256": "950d504015bd97eeb7ebb676691b67b59ae937cc28aff10e5330278713f7df7d" }, "downloads": -1, "filename": "python-otrs-0.4.0.tar.gz", "has_sig": false, "md5_digest": "5fd0bd3bca1102609da4c3a30874b2bb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 13117, "upload_time": "2017-08-21T14:28:08", "url": "https://files.pythonhosted.org/packages/dd/0b/cba98dbf0ddc7049ee4e372e73c50784ddbf43a46555623e0f117c689a4b/python-otrs-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "3a03765b92ce6d4a1cc6ba98cb89e3fa", "sha256": "e1a0773bf91dec4e2f8a53258f0cd09f0c7b18f0e850f07044a778a00891299e" }, "downloads": -1, "filename": "python_otrs-0.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3a03765b92ce6d4a1cc6ba98cb89e3fa", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19563, "upload_time": "2017-08-21T14:52:05", "url": "https://files.pythonhosted.org/packages/34/9e/bc845d28937b76bacd99931618b849874d3a20d8a2795a5843e7bb2a68ff/python_otrs-0.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbe1ed83772a1508510a1a952422cb55", "sha256": "23626d3298bafe312cf02d7c811fdcdabbd300ea76cc75b87cfa14d6123b87cc" }, "downloads": -1, "filename": "python-otrs-0.4.1.tar.gz", "has_sig": false, "md5_digest": "dbe1ed83772a1508510a1a952422cb55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13052, "upload_time": "2017-08-21T14:52:06", "url": "https://files.pythonhosted.org/packages/e4/61/a7808fb16c5dc7223f5beaca1bc594711584a8b3fb1d4087632f3fdd2951/python-otrs-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "51aa433bc1a2132476804375efdbc37e", "sha256": "3fc26ee7ef1f3957ec088ecadcb91dbe1e3a5ff92b8c630955f13ca6df76a6ea" }, "downloads": -1, "filename": "python_otrs-0.4.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "51aa433bc1a2132476804375efdbc37e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 19709, "upload_time": "2017-08-21T15:17:16", "url": "https://files.pythonhosted.org/packages/21/5f/270f3fa1cd2adfe1118ff08d87f32fedd5d10fe4dc60f389be3cab57a5ab/python_otrs-0.4.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "671dfa2756461b9b43119a3813bff9b7", "sha256": "6c44a6d8a4a542031f9ed0c3d16d0595a070defc745d414b2b74b80de5dbd03a" }, "downloads": -1, "filename": "python-otrs-0.4.2.tar.gz", "has_sig": false, "md5_digest": "671dfa2756461b9b43119a3813bff9b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13108, "upload_time": "2017-08-21T15:17:17", "url": "https://files.pythonhosted.org/packages/35/29/b38ef8161b33ad8218f6a5688b565157467d5025be0782d8bf884946fa54/python-otrs-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "f1f222ae4be773f24cef3254b42164ed", "sha256": "e379a89a51cc1baaabdfb06e7e5c91eca6b6e326d93fa50fc9730912c53d6202" }, "downloads": -1, "filename": "python_otrs-0.4.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1f222ae4be773f24cef3254b42164ed", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 19978, "upload_time": "2017-08-21T17:00:45", "url": "https://files.pythonhosted.org/packages/92/98/79805be69525463d82281aa56cc1b490a204a3e018d6a8785fe3c0657fe8/python_otrs-0.4.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c9f4b893987582558944c9c8906db52", "sha256": "d48033ec71a204db9995888c8bc2829d33d18d6a44a52438b6a56db7926e6e40" }, "downloads": -1, "filename": "python-otrs-0.4.3.tar.gz", "has_sig": false, "md5_digest": "4c9f4b893987582558944c9c8906db52", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 13341, "upload_time": "2017-08-21T17:00:47", "url": "https://files.pythonhosted.org/packages/82/b0/c121c3ee589fc63878ae2cd13068231b4673c65a65cf861a9b682d39174f/python-otrs-0.4.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1f222ae4be773f24cef3254b42164ed", "sha256": "e379a89a51cc1baaabdfb06e7e5c91eca6b6e326d93fa50fc9730912c53d6202" }, "downloads": -1, "filename": "python_otrs-0.4.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1f222ae4be773f24cef3254b42164ed", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 19978, "upload_time": "2017-08-21T17:00:45", "url": "https://files.pythonhosted.org/packages/92/98/79805be69525463d82281aa56cc1b490a204a3e018d6a8785fe3c0657fe8/python_otrs-0.4.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4c9f4b893987582558944c9c8906db52", "sha256": "d48033ec71a204db9995888c8bc2829d33d18d6a44a52438b6a56db7926e6e40" }, "downloads": -1, "filename": "python-otrs-0.4.3.tar.gz", "has_sig": false, "md5_digest": "4c9f4b893987582558944c9c8906db52", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4", "size": 13341, "upload_time": "2017-08-21T17:00:47", "url": "https://files.pythonhosted.org/packages/82/b0/c121c3ee589fc63878ae2cd13068231b4673c65a65cf861a9b682d39174f/python-otrs-0.4.3.tar.gz" } ] }