Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
it-bott-integrasjoner
topdesk-client
Commits
049ce76a
Commit
049ce76a
authored
Sep 12, 2019
by
Jo Sama
😱
Browse files
Set password for operators and persons when CU
parent
90d221a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
topdesk_client/client.py
View file @
049ce76a
import
logging
import
requests
import
uuid
from
urllib.parse
import
urljoin
,
urlparse
...
...
@@ -107,15 +108,21 @@ class TopDeskClient:
def
create_operator
(
self
,
operator
):
url
=
self
.
urls
.
get_operators
()
self
.
post
(
url
,
return_response
=
True
,
data
=
operator
.
json
())
# TODO: Remove password setting when proper auth arrives
op
=
operator
.
copy
()
op
.
password
=
uuid
.
uuid4
()
return
self
.
post
(
url
,
return_response
=
True
,
data
=
op
.
json
())
def
update_operator
(
self
,
operator
):
url
=
self
.
urls
.
get_operator
(
operator
.
id
)
self
.
patch
(
url
,
return_response
=
True
,
data
=
operator
.
json
())
# TODO: Remove password setting when proper auth arrives
op
=
operator
.
copy
()
op
.
password
=
uuid
.
uuid4
()
return
self
.
patch
(
url
,
return_response
=
True
,
data
=
op
.
json
())
def
list_operators
(
self
):
for
x
in
self
.
get
(
self
.
urls
.
get_operators
()):
...
...
@@ -127,15 +134,21 @@ class TopDeskClient:
def
create_person
(
self
,
person
):
url
=
self
.
urls
.
get_persons
()
self
.
post
(
url
,
return_response
=
True
,
data
=
person
.
json
())
# TODO: Remove password setting when proper auth arrives
pe
=
person
.
copy
()
pe
.
password
=
uuid
.
uuid4
()
return
self
.
post
(
url
,
return_response
=
True
,
data
=
pe
.
json
())
def
update_person
(
self
,
person
):
url
=
self
.
urls
.
get_person
(
person
.
id
)
self
.
patch
(
url
,
return_response
=
True
,
data
=
person
.
json
())
# TODO: Remove password setting when proper auth arrives
pe
=
person
.
copy
()
pe
.
password
=
uuid
.
uuid4
()
return
self
.
patch
(
url
,
return_response
=
True
,
data
=
pe
.
json
())
def
list_persons
(
self
):
for
x
in
self
.
get
(
self
.
urls
.
get_persons
()):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment