Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyOTRS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Som Connexió
OTRS
PyOTRS
Commits
08273644
Commit
08273644
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
extend Readme and some cleanup
parent
7d68a652
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+45
-3
45 additions, 3 deletions
README.rst
pyotrs/lib.py
+10
-3
10 additions, 3 deletions
pyotrs/lib.py
with
55 additions
and
6 deletions
README.rst
+
45
−
3
View file @
08273644
...
...
@@ -104,7 +104,6 @@ More Examples
True
>>> client.ticket_get_by_id(1)
<Ticket: 1>
>>> my_ticket = client.result[0]
>>> my_ticket.TicketNumber
...
...
@@ -134,8 +133,51 @@ u'Welcome to OTRS!'
[<DynamicField: ProcessManagementActivityID: None>, <DynamicField: ProcessManagementProcessID: None>]
Searching
---------
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'}
>>> 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'}
>>> df = DynamicField("ExternalTicket", "1234")
>>> client.ticket_update(1, dynamic_field_list=[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'}
Search for Tickets
------------------
- get list of Tickets created before a date (e.g. Jan 01, 2011)
...
...
This diff is collapsed.
Click to expand it.
pyotrs/lib.py
+
10
−
3
View file @
08273644
...
...
@@ -229,7 +229,7 @@ class Attachment(object):
return
"
<{0}>
"
.
format
(
self
.
__class__
.
__name__
)
def
to_dct
(
self
):
"""
represent
AttachmentList and related
Attachment object
s
as dict
"""
represent Attachment object as dict
Returns:
**dict**: Attachment represented as dict.
...
...
@@ -300,7 +300,7 @@ class Attachment(object):
"""
dummy data (for testing)
Returns:
**Attachment**: A Attachment object.
**Attachment**: A
n
Attachment object.
"""
return
Attachment
.
create_basic
(
"
YmFyCg==
"
,
"
text/plain
"
,
"
dümmy.txt
"
)
...
...
@@ -402,13 +402,20 @@ class DynamicField(object):
class
Ticket
(
object
):
"""
PyOTRS Ticket class
"""
"""
PyOTRS Ticket class
Args:
tid (int): OTRS Ticket ID as integer
"""
def
__init__
(
self
,
dct
):
for
key
,
value
in
dct
.
items
():
if
isinstance
(
value
,
dict
):
dct
[
key
]
=
Ticket
(
value
)
self
.
__dict__
=
dct
self
.
tid
=
int
(
self
.
__dict__
[
'
TicketID
'
])
self
.
list_articles
=
self
.
_parse_articles
()
self
.
list_dynamic_fields
=
self
.
_parse_dynamic_fields
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment