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
78f4939a
Commit
78f4939a
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
merge type map into operation map
parent
d51b030d
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/lib.py
+36
-40
36 additions, 40 deletions
pyotrs/lib.py
with
36 additions
and
40 deletions
pyotrs/lib.py
+
36
−
40
View file @
78f4939a
...
...
@@ -19,47 +19,44 @@ import requests
OPERATION_MAPPING_DEFAULT
=
{
'
SessionCreate
'
:
{
'
RequestMethod
'
:
'
POST
'
,
'
Route
'
:
'
/Session
'
},
'
Route
'
:
'
/Session
'
,
'
Result
'
:
'
SessionID
'
},
'
TicketCreate
'
:
{
'
RequestMethod
'
:
'
POST
'
,
'
Route
'
:
'
/Ticket
'
},
'
Route
'
:
'
/Ticket
'
,
'
Result
'
:
'
TicketID
'
},
'
TicketGet
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/Ticket/:TicketID
'
},
'
Route
'
:
'
/Ticket/:TicketID
'
,
'
Result
'
:
'
Ticket
'
},
'
TicketGetList
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/TicketList
'
},
'
Route
'
:
'
/TicketList
'
,
'
Result
'
:
'
Ticket
'
},
'
TicketSearch
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/Ticket
'
},
'
Route
'
:
'
/Ticket
'
,
'
Result
'
:
'
TicketID
'
},
'
TicketUpdate
'
:
{
'
RequestMethod
'
:
'
PATCH
'
,
'
Route
'
:
'
/Ticket/:TicketID
'
},
'
Route
'
:
'
/Ticket/:TicketID
'
,
'
Result
'
:
'
TicketID
'
},
'
LinkAdd
'
:
{
'
RequestMethod
'
:
'
POST
'
,
'
Route
'
:
'
/LinkAdd
'
},
'
Route
'
:
'
/LinkAdd
'
,
'
Result
'
:
'
LinkAdd
'
},
'
LinkDelete
'
:
{
'
RequestMethod
'
:
'
DELETE
'
,
'
Route
'
:
'
/LinkDelete
'
},
'
Route
'
:
'
/LinkDelete
'
,
'
Result
'
:
'
LinkDelete
'
},
'
LinkDeleteAll
'
:
{
'
RequestMethod
'
:
'
DELETE
'
,
'
Route
'
:
'
/LinkDeleteAll
'
},
'
Route
'
:
'
/LinkDeleteAll
'
,
'
Result
'
:
'
LinkDeleteAll
'
},
'
LinkList
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/LinkList
'
},
'
Route
'
:
'
/LinkList
'
,
'
Result
'
:
'
LinkList
'
},
'
PossibleLinkList
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/PossibleLinkList
'
},
'
Route
'
:
'
/PossibleLinkList
'
,
'
Result
'
:
'
PossibleLinkList
'
},
'
PossibleObjectsList
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/PossibleObjectsList
'
},
'
Route
'
:
'
/PossibleObjectsList
'
,
'
Result
'
:
'
PossibleObject
'
},
'
PossibleTypesList
'
:
{
'
RequestMethod
'
:
'
GET
'
,
'
Route
'
:
'
/PossibleTypesList
'
}
}
TYPE_MAPPING_DEFAULT
=
{
'
SessionCreate
'
:
'
SessionID
'
,
'
TicketCreate
'
:
'
TicketID
'
,
'
TicketGet
'
:
'
Ticket
'
,
'
TicketGetList
'
:
'
Ticket
'
,
'
TicketSearch
'
:
'
TicketID
'
,
'
TicketUpdate
'
:
'
TicketID
'
,
'
LinkAdd
'
:
'
LinkAdd
'
,
'
LinkDelete
'
:
'
LinkDelete
'
,
'
LinkDeleteAll
'
:
'
LinkDeleteAll
'
,
'
LinkList
'
:
'
LinkList
'
,
'
PossibleLinkList
'
:
'
PossibleLinkList
'
,
'
PossibleObjectsList
'
:
'
PossibleObjectsList
'
,
'
PossibleTypesList
'
:
'
PossibleTypesList
'
'
Route
'
:
'
/PossibleTypesList
'
,
'
Result
'
:
'
PossibleType
'
}
}
...
...
@@ -672,28 +669,32 @@ class Client(object):
password (str): Password
session_id_file (str): Session ID path on disc, used to persistently store Session ID
session_timeout (int): Session Timeout configured in OTRS (usually 28800 seconds = 8h)
session_validation_ticket_id (int): Ticket ID of an existing ticket - used to perform
several check - e.g. validate log in (defaults to 1)
webservicename_link (str): OTRSGenericInterfaceLinkMechanism REST Web Service Name
proxies (dict): Proxy settings - refer to requests docs for
more information - default to no proxies
https_verify (bool): Should HTTPS certificates be verified (defaults to True)
ca_cert_bundle (str): file path - if specified overrides python/system default for
Root CA bundle that will be used.
operation_map (dict): A dictionary for mapping OTRS operations to HTTP Method
and
Route
.
type_map (dict): A dictionary for mapping OTRS result type to operations
.
operation_map (dict): A dictionary for mapping OTRS operations to HTTP Method
,
Route
and
Result string
.
"""
def
__init__
(
self
,
baseurl
=
None
,
webservicename
=
None
,
username
=
None
,
password
=
None
,
session_timeout
=
None
,
session_id_file
=
None
,
session_timeout
=
None
,
session_validation_ticket_id
=
1
,
webservicename_link
=
None
,
proxies
=
None
,
https_verify
=
True
,
ca_cert_bundle
=
None
,
operation_map
=
None
,
type_map
=
None
):
operation_map
=
None
):
if
not
baseurl
:
raise
ArgumentMissingError
(
"
baseurl
"
)
...
...
@@ -741,11 +742,6 @@ class Client(object):
else
:
self
.
operation_map
=
OPERATION_MAPPING_DEFAULT
if
type_map
:
self
.
type_map
=
type_map
else
:
self
.
type_map
=
TYPE_MAPPING_DEFAULT
# credentials
self
.
username
=
username
self
.
password
=
password
...
...
@@ -1254,7 +1250,7 @@ class Client(object):
if
not
payload
:
raise
ArgumentMissingError
(
"
payload
"
)
self
.
_result_type
=
self
.
type
_map
[
self
.
operation
]
self
.
_result_type
=
self
.
operation
_map
[
self
.
operation
]
[
"
Result
"
]
url
=
self
.
_build_url
(
ticket_id
)
...
...
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