PyOTRS


NamePyOTRS JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://gitlab.com/rhab/PyOTRS
SummaryPython wrapper for OTRS (using REST API)
upload_time2024-01-12 21:31:38
maintainerNone
docs_urlNone
authorRobert Habermann
requires_pythonNone
licenseThe MIT License (MIT) Copyright (c) 2016-2020 Robert Habermann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Overview
========

|VersionBadge| |BuildStatus| |CoverageReport| |DocsBuildStatus| |LicenseBadge| |PythonVersions|


.. |VersionBadge| image:: https://badge.fury.io/py/PyOTRS.svg
    :target: https://badge.fury.io/py/PyOTRS
    :alt: |version|

.. |BuildStatus| image:: https://gitlab.com/rhab/PyOTRS/badges/main/pipeline.svg
    :target: https://gitlab.com/rhab/PyOTRS/commits/main
    :alt: Build Status

.. |CoverageReport| image:: https://gitlab.com/rhab/PyOTRS/badges/main/coverage.svg
    :target: https://gitlab.com/rhab/PyOTRS/commits/main
    :alt: Coverage Report

.. |DocsBuildStatus| image:: https://readthedocs.org/projects/pyotrs/badge/?version=stable
    :target: https://pyotrs.readthedocs.org/en/stable/index.html
    :alt: Docs Build Status

.. |LicenseBadge| image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://gitlab.com/rhab/PyOTRS/-/blob/main/LICENSE
    :alt: MIT licensed

.. |PythonVersions| image:: https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9%2C%203.10%2C%203.11-blue.svg
    :alt: python: 3.7, 3.8, 3.9, 3.10, 3.11


PyOTRS is a Python wrapper for accessing `OTRS <https://www.otrs.com/>`_ (Version 5, 6, 7, 8) using the
(GenericInterface) REST API.

Warning
=======

    Please upgrade PyOTRS to at least version 0.10.0 (recommended version is at least 1.0.0) if you
    are using OTRS 6.0.27, 7.0.16 or newer. See `issue 27 <https://gitlab.com/rhab/PyOTRS/-/issues/27>`_
    and `issue 29 <https://gitlab.com/rhab/PyOTRS/-/issues/29>`_ for more details.

    OTRS has introduced a new API in version 8 and with this also changed the API endpoint from
    "Session::SessionCreate" to "AccessToken::Create". PyOTRS attempts to use the new API and will
    fallback to the old way ("legacy") if the attempt fails.


Features
========

Access an OTRS instance to::

    * create a new Ticket
    * get the data of a specific Ticket
    * search for Tickets
    * update existing Tickets
    * access as a "Customer User"

Some of the most notable methods provided are::

    * Client.session_create (Use credentials to "log in")
    * Client.ticket_create
    * Client.ticket_get_by_list  (takes a list)
    * Client.ticket_get_by_id  (takes an int)
    * Client.ticket_search
    * Client.ticket_update

More details can be found `here <pyotrs.html>`_

Installation
============

OTRS Prerequisite
-----------------

You have to enable the **webservices** in your OTRS instance.  It is recommended to use the
provided `template <https://gitlab.com/rhab/PyOTRS/raw/main/webservices_templates/GenericTicketConnectorREST.yml>`_.
This YAML configuration template includes the **Route: /TicketList** and **SessionGet: /Session/:SessionID** endpoint which both are **required for PyOTRS** but which are not included in the default OTRS webservice setup.

Dependencies
------------

*Dependencies are installed automatically*

pip::

    - python-requests


There also is a (completely optional and rudimentary) *interactive* CLI which requires `click`. This
dependency can be installed by calling `pip install PyOTRS[cli]`.

Install
-------

install::

    pip install PyOTRS

**or** consider using a virtual environment::

    virtualenv venv
    source venv/bin/activate
    pip install PyOTRS

Python Usage
============

Quickstart
----------

Get Ticket with TicketID 1 from OTRS over the REST API::

    from pyotrs import Client
    client = Client("https://otrs.example.com", "root@localhost", "password")
    client.session_create()
    client.ticket_get_by_id(1)


The usage of ``Client.session_restore_or_create`` is **recommended**. It uses a temporary file
on the hard drive to store the Session ID (just like cookies in a browser) and avoids sending
the username+password (and therefore creating a new session) on every API call::

    from pyotrs import Client
    client = Client("https://otrs.example.com", "root@localhost", "password")
    client.session_restore_or_create()
    client.ticket_get_by_id(1)

Method ``Client.session_restore_or_set_up_new`` is **deprecated** as of v0.10.

More Examples
-------------

- instantiate a ``Client`` object called **client**
- create a session ("login") on **client**
- get the ``Ticket`` with ID 1

>>> from pyotrs import Article, Client, DynamicField, Ticket
>>> client = Client("http://otrs.example.com", "root@localhost", "password")
>>> client.session_create()
True

>>> my_ticket = client.ticket_get_by_id(1)
>>> my_ticket
<Ticket: 1>

>>> my_ticket.field_get("TicketNumber")
u'2010080210123456'
>>> my_ticket.field_get("Title")
u'Welcome to OTRS!'
>>> my_ticket.to_dct()  # Show complete ticket


- access as a CustomerUser

>>> from pyotrs import Client
>>> client = Client("http://otrs.example.com", "user@customer.example.com", "password", customer_user=True)
>>> client.session_create()
True


- add an ``Article`` to ``Ticket`` with ID 1

>>> my_article = Article({"Subject": "Subj", "Body": "New Body"})
>>> client.ticket_update(1, article=my_article)
{u'ArticleID': u'3',
 u'TicketID': u'1',
 u'TicketNumber': u'2010080210123456'}


- get Articles and Attachments

>>> client.ticket_get_by_id(1, articles=1, attachments=1)
>>> my_ticket = client.result[0]

>>> my_ticket.articles
[<ArticleID: 3>, <ArticleID: 4>

>>> my_ticket.dynamic_fields
[<DynamicField: ProcessManagementActivityID: None>, <DynamicField: ProcessManagementProcessID: None>]


Get Tickets
-----------

>>> client.ticket_get_by_id(1, articles=True, attachments=True, dynamic_fields=True)
<Ticket: 1>

>>> client.ticket_get_by_list([1, 3, 4], dynamic_fields=False)
[<Ticket: 1>, <Ticket: 3>, <Ticket: 4>]


Update Tickets
--------------

>>> client.ticket_update(1, Title="New Title")
{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}

>>> client.ticket_update(1, Queue="New Queue")
{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}

>>> client.ticket_update(1, Queue="New Queue", State="closed")
{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}

>>> my_article = Article({"Subject": "Subj", "Body": "New Body"})
>>> client.ticket_update(1, article=my_article)
{u'ArticleID': u'3',
 u'TicketID': u'1',
 u'TicketNumber': u'2010080210123456'}


>>> att = Attachment.create_from_file("./test_data/asd.txt")
>>> client.ticket_update(ticket_id=1, article=my_article, attachments=[att])
{'ArticleID': '7927', 'TicketID': '1', 'TicketNumber': '2010080210123456'}

>>> df = DynamicField("ExternalTicket", "1234")
>>> client.ticket_update(1, dynamic_fields=[df])
{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}


Create Tickets
--------------

OTRS requires that new Tickets have several fields filled with valid values and that an
Article is present for the new Ticket.

>>> new_ticket = Ticket.create_basic(Title="This is the Title",
                                     Queue="Raw",
                                     State=u"new",
                                     Priority=u"3 normal",
                                     CustomerUser="root@localhost")
>>> first_article = Article({"Subject": "Subj", "Body": "New Body"})
>>> client.ticket_create(new_ticket, first_article)
{u'ArticleID': u'9', u'TicketID': u'7', u'TicketNumber': u'2016110528000013'}


Article body with HTML
----------------------

PyOTRS defaults to using the MIME type "text/plain". By specifying a different type it is possible to e.g. add a HTML body.

>>> first_article = Article({"Subject": "Subj",
                             "Body": "<html><body><h1>This is a header</h1>" \
                                     "<a href='https://pyotrs.readthedocs.io/'>Link to PyOTRS Docs</a></body></html>",
                             "MimeType": "text/html"})
>>> client.ticket_update(10, first_article)
{u'ArticleID': u'29', u'TicketID': u'10', u'TicketNumber': u'2017052328000034'}


Search for Tickets
------------------

- get list of Tickets created before a date (e.g. Jan 01, 2011)

>>> from datetime import datetime
>>> client.ticket_search(TicketCreateTimeOlderDate=datetime(2011, 1, 1))
[u'1']


- get list of Tickets created less than a certain time ago (e.g. younger than 1 week)

>>> from datetime import datetime
>>> from datetime import timedelta
>>> client.ticket_search(TicketCreateTimeNewerDate=datetime.utcnow() - timedelta(days=7))
[u'66', u'65', u'64', u'63']


- show tickets with either 'open' or 'new' state in Queue 12 created over a week ago

>>> from datetime import datetime
>>> from datetime import timedelta
>>> week = datetime.utcnow() - timedelta(days=7)
>>> client.ticket_search(TicketCreateTimeOlderDate=week, States=['open', 'new'], QueueIDs=[12])

- empty result (search worked, but there are no matching tickets)

>>> client.ticket_search(Title="no such ticket")
[]

- search for content of DynamicFields

>>> df = DynamicField("ExternalTicket", search_patterns=["1234"])
>>> client.ticket_search(dynamic_fields=[df])
[u'2']

>>> df = DynamicField("ExternalTicket", search_patterns=["123*"], search_operator="Like")
>>> client.ticket_search([df])
[u'2']



Tips
----

**If needed** the *insecure plattform warnings* can be disabled::

    # turn off platform insecurity warnings from urllib3
    from requests.packages.urllib3 import disable_warnings
    disable_warnings()  # TODO 2016-04-23 (RH) verify this

PyOTRS Shell CLI
================

The PyOTRS Shell CLI is a kind of "proof-of-concept" for the PyOTRS wrapper library.

**Attention: PyOTRS can only retrieve Ticket data at the moment!**

Usage
-----

Get a Ticket::

    pyotrs get -b https://otrs.example.com/ -u root@localhost -p password -t 1
    Starting PyOTRS CLI
    No config file found at: /home/user/.pyotrs
    Connecting to https://otrs.example.com/ as user..
    Ticket:         Welcome to OTRS!
    Queue:          Raw
    State:          closed successful
    Priority:       3 normal

Get usage information::

    $: pyotrs -h
    Usage: PyOTRS [OPTIONS] COMMAND [ARGS]...

    Options:
      --version      Show the version and exit.
      --config PATH  Config File
      -h, --help     Show this message and exit.

    Commands:
      get  PyOTRS get command

    $:pyotrs get -h
    Starting PyOTRS CLI
    No config file found at: /home/user/.pyotrs
    Usage: PyOTRS get [OPTIONS]

      PyOTRS get command

    Options:
      -b, --baseurl TEXT              Base URL
      -u, --username TEXT             Username
      -p, --password TEXT             Password
      -t, --ticket-id INTEGER         Ticket ID
      --store-path TEXT               where to store Attachments (default:
                                      /tmp/pyotrs_<random_str>
      --store-attachments             store Article Attachments to
                                      /tmp/<ticket_id>
      --attachments                   include Article Attachments
      --articles                      include Articles
      --https-verify / --no-https-verify
                                      HTTPS(SSL/TLS) Certificate validation
                                      (default: enabled)
      --ca-cert-bundle TEXT           CA CERT Bundle (Path)
      -h, --help                      Show this message and exit.


Get a Ticket "*interactively*\"::

    $: pyotrs get
    Starting PyOTRS CLI
    No config file found at: /home/user/.pyotrs
    Baseurl: http://otrs.example.com
    Username: user
    Password:
    Ticket id: 1

    Connecting to https://otrs.example.com as user..

    Ticket:         Welcome to OTRS!
    Queue:          Raw
    State:          closed successful
    Priority:       3 normal

    Full Ticket:
    {u'Ticket': {u'TypeID': 1  [...]



Provide Config
--------------

There are four ways to provide config values::

    1. interactively when prompted
    2. as commandline arguments when calling (checkout -h/--help)
    3. as settings in the environment
    4. in a config file (default location: ~/.pyotrs)

Both the config file and the environment use the same variable names::

    PYOTRS_BASEURL=http://otrs.example.com
    PYOTRS_USERNAME=root@localhost
    PYOTRS_PASSWORD=otrs_password
    PYOTRS_HTTPS_VERIFY=True
    PYOTRS_CA_CERT_BUNDLE=


License
=======

`MIT License <http://en.wikipedia.org/wiki/MIT_License>`__

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/rhab/PyOTRS",
    "name": "PyOTRS",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Robert Habermann",
    "author_email": "mail@rhab.de",
    "download_url": "https://files.pythonhosted.org/packages/0b/c0/672af3ae69199ad2655c6143bf6da596e41abd4d4677a6378b1db15f287d/PyOTRS-1.1.2.tar.gz",
    "platform": null,
    "description": "Overview\n========\n\n|VersionBadge| |BuildStatus| |CoverageReport| |DocsBuildStatus| |LicenseBadge| |PythonVersions|\n\n\n.. |VersionBadge| image:: https://badge.fury.io/py/PyOTRS.svg\n    :target: https://badge.fury.io/py/PyOTRS\n    :alt: |version|\n\n.. |BuildStatus| image:: https://gitlab.com/rhab/PyOTRS/badges/main/pipeline.svg\n    :target: https://gitlab.com/rhab/PyOTRS/commits/main\n    :alt: Build Status\n\n.. |CoverageReport| image:: https://gitlab.com/rhab/PyOTRS/badges/main/coverage.svg\n    :target: https://gitlab.com/rhab/PyOTRS/commits/main\n    :alt: Coverage Report\n\n.. |DocsBuildStatus| image:: https://readthedocs.org/projects/pyotrs/badge/?version=stable\n    :target: https://pyotrs.readthedocs.org/en/stable/index.html\n    :alt: Docs Build Status\n\n.. |LicenseBadge| image:: https://img.shields.io/badge/license-MIT-blue.svg\n    :target: https://gitlab.com/rhab/PyOTRS/-/blob/main/LICENSE\n    :alt: MIT licensed\n\n.. |PythonVersions| image:: https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9%2C%203.10%2C%203.11-blue.svg\n    :alt: python: 3.7, 3.8, 3.9, 3.10, 3.11\n\n\nPyOTRS is a Python wrapper for accessing `OTRS <https://www.otrs.com/>`_ (Version 5, 6, 7, 8) using the\n(GenericInterface) REST API.\n\nWarning\n=======\n\n    Please upgrade PyOTRS to at least version 0.10.0 (recommended version is at least 1.0.0) if you\n    are using OTRS 6.0.27, 7.0.16 or newer. See `issue 27 <https://gitlab.com/rhab/PyOTRS/-/issues/27>`_\n    and `issue 29 <https://gitlab.com/rhab/PyOTRS/-/issues/29>`_ for more details.\n\n    OTRS has introduced a new API in version 8 and with this also changed the API endpoint from\n    \"Session::SessionCreate\" to \"AccessToken::Create\". PyOTRS attempts to use the new API and will\n    fallback to the old way (\"legacy\") if the attempt fails.\n\n\nFeatures\n========\n\nAccess an OTRS instance to::\n\n    * create a new Ticket\n    * get the data of a specific Ticket\n    * search for Tickets\n    * update existing Tickets\n    * access as a \"Customer User\"\n\nSome of the most notable methods provided are::\n\n    * Client.session_create (Use credentials to \"log in\")\n    * Client.ticket_create\n    * Client.ticket_get_by_list  (takes a list)\n    * Client.ticket_get_by_id  (takes an int)\n    * Client.ticket_search\n    * Client.ticket_update\n\nMore details can be found `here <pyotrs.html>`_\n\nInstallation\n============\n\nOTRS Prerequisite\n-----------------\n\nYou have to enable the **webservices** in your OTRS instance.  It is recommended to use the\nprovided `template <https://gitlab.com/rhab/PyOTRS/raw/main/webservices_templates/GenericTicketConnectorREST.yml>`_.\nThis YAML configuration template includes the **Route: /TicketList** and **SessionGet: /Session/:SessionID** endpoint which both are **required for PyOTRS** but which are not included in the default OTRS webservice setup.\n\nDependencies\n------------\n\n*Dependencies are installed automatically*\n\npip::\n\n    - python-requests\n\n\nThere also is a (completely optional and rudimentary) *interactive* CLI which requires `click`. This\ndependency can be installed by calling `pip install PyOTRS[cli]`.\n\nInstall\n-------\n\ninstall::\n\n    pip install PyOTRS\n\n**or** consider using a virtual environment::\n\n    virtualenv venv\n    source venv/bin/activate\n    pip install PyOTRS\n\nPython Usage\n============\n\nQuickstart\n----------\n\nGet Ticket with TicketID 1 from OTRS over the REST API::\n\n    from pyotrs import Client\n    client = Client(\"https://otrs.example.com\", \"root@localhost\", \"password\")\n    client.session_create()\n    client.ticket_get_by_id(1)\n\n\nThe usage of ``Client.session_restore_or_create`` is **recommended**. It uses a temporary file\non the hard drive to store the Session ID (just like cookies in a browser) and avoids sending\nthe username+password (and therefore creating a new session) on every API call::\n\n    from pyotrs import Client\n    client = Client(\"https://otrs.example.com\", \"root@localhost\", \"password\")\n    client.session_restore_or_create()\n    client.ticket_get_by_id(1)\n\nMethod ``Client.session_restore_or_set_up_new`` is **deprecated** as of v0.10.\n\nMore Examples\n-------------\n\n- instantiate a ``Client`` object called **client**\n- create a session (\"login\") on **client**\n- get the ``Ticket`` with ID 1\n\n>>> from pyotrs import Article, Client, DynamicField, Ticket\n>>> client = Client(\"http://otrs.example.com\", \"root@localhost\", \"password\")\n>>> client.session_create()\nTrue\n\n>>> my_ticket = client.ticket_get_by_id(1)\n>>> my_ticket\n<Ticket: 1>\n\n>>> my_ticket.field_get(\"TicketNumber\")\nu'2010080210123456'\n>>> my_ticket.field_get(\"Title\")\nu'Welcome to OTRS!'\n>>> my_ticket.to_dct()  # Show complete ticket\n\n\n- access as a CustomerUser\n\n>>> from pyotrs import Client\n>>> client = Client(\"http://otrs.example.com\", \"user@customer.example.com\", \"password\", customer_user=True)\n>>> client.session_create()\nTrue\n\n\n- add an ``Article`` to ``Ticket`` with ID 1\n\n>>> my_article = Article({\"Subject\": \"Subj\", \"Body\": \"New Body\"})\n>>> client.ticket_update(1, article=my_article)\n{u'ArticleID': u'3',\n u'TicketID': u'1',\n u'TicketNumber': u'2010080210123456'}\n\n\n- get Articles and Attachments\n\n>>> client.ticket_get_by_id(1, articles=1, attachments=1)\n>>> my_ticket = client.result[0]\n\n>>> my_ticket.articles\n[<ArticleID: 3>, <ArticleID: 4>\n\n>>> my_ticket.dynamic_fields\n[<DynamicField: ProcessManagementActivityID: None>, <DynamicField: ProcessManagementProcessID: None>]\n\n\nGet Tickets\n-----------\n\n>>> client.ticket_get_by_id(1, articles=True, attachments=True, dynamic_fields=True)\n<Ticket: 1>\n\n>>> client.ticket_get_by_list([1, 3, 4], dynamic_fields=False)\n[<Ticket: 1>, <Ticket: 3>, <Ticket: 4>]\n\n\nUpdate Tickets\n--------------\n\n>>> client.ticket_update(1, Title=\"New Title\")\n{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}\n\n>>> client.ticket_update(1, Queue=\"New Queue\")\n{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}\n\n>>> client.ticket_update(1, Queue=\"New Queue\", State=\"closed\")\n{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}\n\n>>> my_article = Article({\"Subject\": \"Subj\", \"Body\": \"New Body\"})\n>>> client.ticket_update(1, article=my_article)\n{u'ArticleID': u'3',\n u'TicketID': u'1',\n u'TicketNumber': u'2010080210123456'}\n\n\n>>> att = Attachment.create_from_file(\"./test_data/asd.txt\")\n>>> client.ticket_update(ticket_id=1, article=my_article, attachments=[att])\n{'ArticleID': '7927', 'TicketID': '1', 'TicketNumber': '2010080210123456'}\n\n>>> df = DynamicField(\"ExternalTicket\", \"1234\")\n>>> client.ticket_update(1, dynamic_fields=[df])\n{u'TicketID': u'1', u'TicketNumber': u'2010080210123456'}\n\n\nCreate Tickets\n--------------\n\nOTRS requires that new Tickets have several fields filled with valid values and that an\nArticle is present for the new Ticket.\n\n>>> new_ticket = Ticket.create_basic(Title=\"This is the Title\",\n                                     Queue=\"Raw\",\n                                     State=u\"new\",\n                                     Priority=u\"3 normal\",\n                                     CustomerUser=\"root@localhost\")\n>>> first_article = Article({\"Subject\": \"Subj\", \"Body\": \"New Body\"})\n>>> client.ticket_create(new_ticket, first_article)\n{u'ArticleID': u'9', u'TicketID': u'7', u'TicketNumber': u'2016110528000013'}\n\n\nArticle body with HTML\n----------------------\n\nPyOTRS defaults to using the MIME type \"text/plain\". By specifying a different type it is possible to e.g. add a HTML body.\n\n>>> first_article = Article({\"Subject\": \"Subj\",\n                             \"Body\": \"<html><body><h1>This is a header</h1>\" \\\n                                     \"<a href='https://pyotrs.readthedocs.io/'>Link to PyOTRS Docs</a></body></html>\",\n                             \"MimeType\": \"text/html\"})\n>>> client.ticket_update(10, first_article)\n{u'ArticleID': u'29', u'TicketID': u'10', u'TicketNumber': u'2017052328000034'}\n\n\nSearch for Tickets\n------------------\n\n- get list of Tickets created before a date (e.g. Jan 01, 2011)\n\n>>> from datetime import datetime\n>>> client.ticket_search(TicketCreateTimeOlderDate=datetime(2011, 1, 1))\n[u'1']\n\n\n- get list of Tickets created less than a certain time ago (e.g. younger than 1 week)\n\n>>> from datetime import datetime\n>>> from datetime import timedelta\n>>> client.ticket_search(TicketCreateTimeNewerDate=datetime.utcnow() - timedelta(days=7))\n[u'66', u'65', u'64', u'63']\n\n\n- show tickets with either 'open' or 'new' state in Queue 12 created over a week ago\n\n>>> from datetime import datetime\n>>> from datetime import timedelta\n>>> week = datetime.utcnow() - timedelta(days=7)\n>>> client.ticket_search(TicketCreateTimeOlderDate=week, States=['open', 'new'], QueueIDs=[12])\n\n- empty result (search worked, but there are no matching tickets)\n\n>>> client.ticket_search(Title=\"no such ticket\")\n[]\n\n- search for content of DynamicFields\n\n>>> df = DynamicField(\"ExternalTicket\", search_patterns=[\"1234\"])\n>>> client.ticket_search(dynamic_fields=[df])\n[u'2']\n\n>>> df = DynamicField(\"ExternalTicket\", search_patterns=[\"123*\"], search_operator=\"Like\")\n>>> client.ticket_search([df])\n[u'2']\n\n\n\nTips\n----\n\n**If needed** the *insecure plattform warnings* can be disabled::\n\n    # turn off platform insecurity warnings from urllib3\n    from requests.packages.urllib3 import disable_warnings\n    disable_warnings()  # TODO 2016-04-23 (RH) verify this\n\nPyOTRS Shell CLI\n================\n\nThe PyOTRS Shell CLI is a kind of \"proof-of-concept\" for the PyOTRS wrapper library.\n\n**Attention: PyOTRS can only retrieve Ticket data at the moment!**\n\nUsage\n-----\n\nGet a Ticket::\n\n    pyotrs get -b https://otrs.example.com/ -u root@localhost -p password -t 1\n    Starting PyOTRS CLI\n    No config file found at: /home/user/.pyotrs\n    Connecting to https://otrs.example.com/ as user..\n    Ticket:         Welcome to OTRS!\n    Queue:          Raw\n    State:          closed successful\n    Priority:       3 normal\n\nGet usage information::\n\n    $: pyotrs -h\n    Usage: PyOTRS [OPTIONS] COMMAND [ARGS]...\n\n    Options:\n      --version      Show the version and exit.\n      --config PATH  Config File\n      -h, --help     Show this message and exit.\n\n    Commands:\n      get  PyOTRS get command\n\n    $:pyotrs get -h\n    Starting PyOTRS CLI\n    No config file found at: /home/user/.pyotrs\n    Usage: PyOTRS get [OPTIONS]\n\n      PyOTRS get command\n\n    Options:\n      -b, --baseurl TEXT              Base URL\n      -u, --username TEXT             Username\n      -p, --password TEXT             Password\n      -t, --ticket-id INTEGER         Ticket ID\n      --store-path TEXT               where to store Attachments (default:\n                                      /tmp/pyotrs_<random_str>\n      --store-attachments             store Article Attachments to\n                                      /tmp/<ticket_id>\n      --attachments                   include Article Attachments\n      --articles                      include Articles\n      --https-verify / --no-https-verify\n                                      HTTPS(SSL/TLS) Certificate validation\n                                      (default: enabled)\n      --ca-cert-bundle TEXT           CA CERT Bundle (Path)\n      -h, --help                      Show this message and exit.\n\n\nGet a Ticket \"*interactively*\\\"::\n\n    $: pyotrs get\n    Starting PyOTRS CLI\n    No config file found at: /home/user/.pyotrs\n    Baseurl: http://otrs.example.com\n    Username: user\n    Password:\n    Ticket id: 1\n\n    Connecting to https://otrs.example.com as user..\n\n    Ticket:         Welcome to OTRS!\n    Queue:          Raw\n    State:          closed successful\n    Priority:       3 normal\n\n    Full Ticket:\n    {u'Ticket': {u'TypeID': 1  [...]\n\n\n\nProvide Config\n--------------\n\nThere are four ways to provide config values::\n\n    1. interactively when prompted\n    2. as commandline arguments when calling (checkout -h/--help)\n    3. as settings in the environment\n    4. in a config file (default location: ~/.pyotrs)\n\nBoth the config file and the environment use the same variable names::\n\n    PYOTRS_BASEURL=http://otrs.example.com\n    PYOTRS_USERNAME=root@localhost\n    PYOTRS_PASSWORD=otrs_password\n    PYOTRS_HTTPS_VERIFY=True\n    PYOTRS_CA_CERT_BUNDLE=\n\n\nLicense\n=======\n\n`MIT License <http://en.wikipedia.org/wiki/MIT_License>`__\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)\n\nCopyright (c) 2016-2020 Robert Habermann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "summary": "Python wrapper for OTRS (using REST API)",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://gitlab.com/rhab/PyOTRS"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e92815bd3db3c58de77eb076cfdb60e8099f188be9ab9606f31481c28a49ffbd",
                "md5": "d9c456c24eda5c738fbb91d6f82020b4",
                "sha256": "fe212732f2d66dd17bcb398379359ddf5644d4cc675d93964300aef24c9cbfe3"
            },
            "downloads": -1,
            "filename": "PyOTRS-1.1.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9c456c24eda5c738fbb91d6f82020b4",
            "packagetype": "bdist_wheel",
            "python_version": "3.8",
            "requires_python": null,
            "size": 47287,
            "upload_time": "2024-01-12T21:31:40",
            "upload_time_iso_8601": "2024-01-12T21:31:40.928202Z",
            "url": "https://files.pythonhosted.org/packages/e9/28/15bd3db3c58de77eb076cfdb60e8099f188be9ab9606f31481c28a49ffbd/PyOTRS-1.1.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bc0672af3ae69199ad2655c6143bf6da596e41abd4d4677a6378b1db15f287d",
                "md5": "483a8df917160fd8fe63fde865dbc4de",
                "sha256": "d1f171d17a51ba95b4d9553cc835d5fb0ee9f6d9e395337d580e4f6bc304e7f0"
            },
            "downloads": -1,
            "filename": "PyOTRS-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "483a8df917160fd8fe63fde865dbc4de",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26439,
            "upload_time": "2024-01-12T21:31:38",
            "upload_time_iso_8601": "2024-01-12T21:31:38.699209Z",
            "url": "https://files.pythonhosted.org/packages/0b/c0/672af3ae69199ad2655c6143bf6da596e41abd4d4677a6378b1db15f287d/PyOTRS-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 21:31:38",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "rhab",
    "gitlab_project": "PyOTRS",
    "lcname": "pyotrs"
}
        
Elapsed time: 0.15681s