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
e1cb4a5a
Commit
e1cb4a5a
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
fix docs
parent
983b058c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyotrs/client.py
+44
-53
44 additions, 53 deletions
pyotrs/client.py
with
44 additions
and
53 deletions
pyotrs/client.py
+
44
−
53
View file @
e1cb4a5a
...
...
@@ -8,6 +8,8 @@ Date: 2015-07-20
https://otrs.github.io/doc/api/otrs/5.0/Perl/index.html
```
Kernel::GenericInterface::Operation GenericInterface Operation interface
Kernel::GenericInterface::Operation
...
...
@@ -20,12 +22,7 @@ Kernel::GenericInterface::Operation
::Ticket::TicketGet GenericInterface Ticket Get Operation backend
::Ticket::TicketSearch GenericInterface Ticket Search Operation backend
::Ticket::TicketUpdate GenericInterface Ticket TicketUpdate Operation backend
Session implemented in Class *Client(object)*
TicketCreate implemented in Class *TicketCreate(Client)*
TicketGet implemented in Class *TicketGet(Client)*
TicketSearch implemented in Class *TicketSearch(Client)*
TicketUpdate implemented in Class *TicketUpdate(Client)*
```
"""
...
...
@@ -172,7 +169,7 @@ class Client(object):
"""
check whether Session ID (self.session_id) is currently valid
Returns:
True if valid
;
otherwise
False
bool:
True if valid
, False
otherwise
.
Raises:
SessionError is self.session_id is not set
...
...
@@ -322,7 +319,7 @@ class Client(object):
all_articles (bool): will request OTRS to include all Articles (default: False)
Returns:
T
ic
ket as dic
t
d
ic
t: Ticke
t
"""
...
...
@@ -357,7 +354,7 @@ class Client(object):
ResponseJSONParseError
Returns:
True if
get was
successful
;
otherwise
False
bool:
True if successful
, False
otherwise
.
"""
...
...
@@ -456,7 +453,7 @@ class Client(object):
**kwargs
Returns:
L
ist
of
tickets that were found
l
ist
:
tickets that were found
Notes:
If value of kwargs is a datetime object then this object will be
...
...
@@ -493,7 +490,7 @@ class Client(object):
pattern (str)
Returns:
L
ist
of
tickets that were found
l
ist
:
tickets that were found
"""
...
...
@@ -519,7 +516,7 @@ class Client(object):
ResponseJSONParseError
Returns:
True if search
was
successful
;
otherwise
False
bool:
True if search successful
, False
otherwise
.
"""
...
...
@@ -583,9 +580,7 @@ class Client(object):
# public methods
# * ticket_update_add_article
# * ticket_update_set_dynamic_field_value
# * ticket_update_set_state
# * ticket_update_set_state_pending
# * ticket_update_set_title
# * ticket_update_set_pending
def
ticket_update_add_article
(
self
,
ticket_id
,
article_subject
,
article_body
):
"""
ticket_update_by_ticket_id_set_scout_id
...
...
@@ -596,7 +591,7 @@ class Client(object):
article_body (str):
Returns:
True if update
was
successful
;
otherwise
False
bool:
True if update successful
, False
otherwise
.
"""
url
=
"
{0.baseurl}/otrs/nph-genericinterface.pl/Webservice/
"
\
...
...
@@ -622,17 +617,17 @@ class Client(object):
logger
.
error
(
"
Exception: {0}
"
.
format
(
err
))
return
False
def
ticket_update_set_dynamic_field
_value
(
self
,
ticket_id
,
**
kwargs
):
"""
ticket_update_set_dynamic_field
_value
def
ticket_update_set_dynamic_field
s
(
self
,
ticket_id
,
**
kwargs
):
"""
ticket_update_set_dynamic_field
s
Args:
ticket_id (int):
**kwargs
Returns:
True if update
was
successful
;
otherwise
False
bool:
True if update successful
, False
otherwise
.
"""
...
...
@@ -660,36 +655,11 @@ class Client(object):
logger
.
error
(
"
Exception: {0}
"
.
format
(
err
))
return
False
@staticmethod
def
datetime_to_pending_time_str
(
datetime_obj
=
None
):
"""
datetime_to_pending_time_str
Args:
datetime_obj:
Returns:
str representing the REST pending time string format
Examples:
>>>
sorted
(
Client
.
datetime_to_pending_time_str
(
datetime
.
datetime
(
1970
,
1
,
1
,
0
,
0
)).
items
())
[(
'
Day
'
,
1
),
(
'
Hour
'
,
0
),
(
'
Minute
'
,
0
),
(
'
Month
'
,
1
),
(
'
Year
'
,
1970
)]
"""
pending_time_str
=
{
"
Year
"
:
datetime_obj
.
year
,
"
Month
"
:
datetime_obj
.
month
,
"
Day
"
:
datetime_obj
.
day
,
"
Hour
"
:
datetime_obj
.
hour
,
"
Minute
"
:
datetime_obj
.
minute
}
return
pending_time_str
def
ticket_update_set_state_pending
(
self
,
ticket_id
,
new_state
=
"
pending reminder
"
,
pending_days
=
1
,
pending_hours
=
0
):
def
ticket_update_set_pending
(
self
,
ticket_id
,
new_state
=
"
pending reminder
"
,
pending_days
=
1
,
pending_hours
=
0
):
"""
ticket_update_set_state_pending
Args:
...
...
@@ -699,7 +669,7 @@ class Client(object):
pending_hours (int): defaults to 0
Returns:
True if update
was
successful
;
otherwise
False
bool:
True if update successful
, False
otherwise
.
"""
url
=
"
{0.baseurl}/otrs/nph-genericinterface.pl/Webservice/
"
\
...
...
@@ -724,6 +694,27 @@ class Client(object):
logger
.
error
(
"
Exception: {0}
"
.
format
(
err
))
return
False
@staticmethod
def
datetime_to_pending_time_str
(
datetime_obj
=
None
):
"""
datetime_to_pending_time_str
Args:
datetime_obj:
Returns:
str: representing the pending time string format for OTRS REST interface
"""
pending_time_str
=
{
"
Year
"
:
datetime_obj
.
year
,
"
Month
"
:
datetime_obj
.
month
,
"
Day
"
:
datetime_obj
.
day
,
"
Hour
"
:
datetime_obj
.
hour
,
"
Minute
"
:
datetime_obj
.
minute
}
return
pending_time_str
def
_update_by_ticket_id
(
self
,
url
,
payload
):
"""
update_by_ticket_id
...
...
@@ -736,7 +727,7 @@ class Client(object):
OTRSAPIError
Returns:
True if update
was
successful
;
otherwise
False
bool:
True if update successful
, False
otherwise
.
"""
...
...
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