File: PKG-INFO

package info (click to toggle)
python-rt 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 516 kB
  • sloc: python: 3,144; makefile: 141; sh: 7
file content (173 lines) | stat: -rw-r--r-- 6,454 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
Metadata-Version: 2.1
Name: rt
Version: 3.2.0
Summary: Python interface to Request Tracker API
Author-email: Georges Toth <georges.toth@govcert.etat.lu>
License: GNU General Public License v3 (GPLv3)
Project-URL: Homepage, https://github.com/python-rt/python-rt
Project-URL: Documentation, https://python-rt.readthedocs.io/
Project-URL: Source, https://github.com/python-rt/python-rt
Project-URL: Tracker, https://github.com/python-rt/python-rt/issues
Project-URL: Changelog, https://github.com/python-rt/python-rt/blob/master/CHANGELOG.md
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
License-File: AUTHORS
Requires-Dist: requests
Requires-Dist: httpx
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: furo; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Provides-Extra: dev
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: codespell; extra == "dev"
Requires-Dist: bandit; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Requires-Dist: coverage; extra == "test"

.. image:: https://codebeat.co/badges/a52cfe15-b824-435b-a594-4bf2be2fb06f
    :target: https://codebeat.co/projects/github-com-python-rt-python-rt-master
    :alt: codebeat badge
.. image:: https://github.com/python-rt/python-rt/actions/workflows/test_lint.yml/badge.svg
    :target: https://github.com/python-rt/python-rt/actions/workflows/test_lint.yml
    :alt: tests
.. image:: https://readthedocs.org/projects/python-rt/badge/?version=stable
    :target: https://python-rt.readthedocs.io/en/stable/?badge=stable
    :alt: Documentation Status
.. image:: https://badge.fury.io/py/rt.svg
    :target: https://badge.fury.io/py/rt

==============================================
 Rt - Python interface to Request Tracker API 
==============================================

Python implementation of REST API described here:
 - https://rt-wiki.bestpractical.com/wiki/REST
 - https://docs.bestpractical.com/rt/5.0.2/RT/REST2.html

.. csv-table:: Python version compatibility:
   :header: "Python", "rt"
   :widths: 15, 15

   "2.7", "< 2.0.0"
   ">= 3.5, <3.7", ">= 2.0.0, < 3.0.0"
   ">= 3.7", ">= 3.0.0, < 3.1.0"
   ">= 3.8", ">= 3.0.0"

ℹ️ **Note**:
    Please note that starting with the major release of v3.0.0, this library requires Python version >= 3.8.
    See the *Python version compatibility* table above for more detailed information.

⚡ **Note**:
    As of version 3.1.0, this library is async compatible.
    Usage::

      import rt.rest2
      import httpx

      tracker = rt.rest2.AsyncRt('http://localhost/rt/REST/2.0/', http_auth=httpx.BasicAuth('root', 'password'))

⚠️ **Warning**:
    Though version 3.x still supports RT REST API version 1, it contains minor breaking changes. Please see the changelog
    in the documentation for details.

Requirements
============

This module uses following Python modules:
 - requests (http://docs.python-requests.org/)
 - requests-toolbelt (https://pypi.org/project/requests-toolbelt/)
 - typing-extensions (depending on python version)

Documentation
=============
https://python-rt.readthedocs.io/en/latest/

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

Install the python-rt package using::

  pip install rt


Licence
=======

This module is distributed under the terms of GNU General Public Licence v3
and was developed by CZ.NIC Labs - research and development department of
CZ.NIC association - top level domain registry for .CZ.  Copy of the GNU
General Public License is distributed along with this module.

Usage
=====

An example is worth a thousand words::

    >>> import rt.rest2
    >>> import httpx
    >>> tracker = rt.rest2.Rt('http://localhost/rt/REST/2.0/', http_auth=httpx.BasicAuth('root', 'password'))
    >>> map(lambda x: x['id'], tracker.search(Queue='helpdesk', Status='open'))
    ['1', '2', '10', '15']
    >>> tracker.create_ticket(queue='helpdesk', \
    ... subject='Coffee (important)', content='Help I Ran Out of Coffee!')
    19
    >>> tracker.edit_ticket(19, Requestor='addicted@example.com')
    True
    >>> tracker.reply(19, content='Do you know Starbucks?')
    True

Get the last important updates from a specific queue that have been updated recently::

    >>> import datetime
    >>> import base64
    >>> import rt.rest2
    >>> import httpx
    >>> tracker = rt.rest2.Rt('http://localhost/rt/REST/2.0/', http_auth=httpx.BasicAuth('root', 'password'))
    >>> fifteen_minutes_ago = str(datetime.datetime.now() - datetime.timedelta(minutes=15))
    >>> tickets = tracker.last_updated(since=fifteen_minutes_ago)
    >>> for ticket in tickets:
    >>>     id = ticket['id']
    >>>     history = tracker.get_ticket_history(id)
    >>>     last_update = list(reversed([h for h in history if h['Type'] in ('Correspond', 'Comment')]))
    >>>     hid = tracker.get_transaction(last_update[0]['id'] if last_update else history[0]['id'])
    >>>
    >>>     attachment_id = None
    >>>     for k in hid['_hyperlinks']:
    >>>         if k['ref'] == 'attachment':
    >>>             attachment_id = k['_url'].rsplit('/', 1)[1]
    >>>             break
    >>>
    >>>         if attachment_id is not None:
    >>>             attachment = c.get_attachment(attachment_id)
    >>>             if attachment['Content'] is not None:
    >>>                 content = base64.b64decode(attachment['Content']).decode()
    >>>                 print(content)


		
Please use docstrings to see how to use different functions. They are written
in ReStructuredText. You can also generate HTML documentation by running
``make html`` in doc directory (Sphinx required).

Official Site
=============

Project site, issue tracking and git repository:
    https://github.com/python-rt/python-rt