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
da0a42c3
Commit
da0a42c3
authored
Jan 10, 2020
by
Jo Sama
😱
Browse files
Fix headers and autentication
parent
f73c50a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
topdesk_client/client.py
View file @
da0a42c3
...
...
@@ -71,14 +71,17 @@ class Endpoints:
class
TopDeskClient
:
def
__init__
(
self
,
url
,
username
,
password
,
username
=
None
,
password
=
None
,
headers
=
{},
rewrite_url
=
None
):
self
.
urls
=
Endpoints
(
url
)
self
.
rewrite_url
=
rewrite_url
self
.
headers
=
headers
self
.
auth
=
requests
.
auth
.
HTTPBasicAuth
(
username
,
password
)
if
username
and
password
:
self
.
auth
=
requests
.
auth
.
HTTPBasicAuth
(
username
,
password
)
else
:
self
.
auth
=
None
def
_build_headers
(
self
,
headers
):
request_headers
=
{}
...
...
@@ -103,7 +106,7 @@ class TopDeskClient:
(
url
if
self
.
rewrite_url
is
None
else
url
.
replace
(
*
self
.
rewrite_url
)),
auth
=
self
.
auth
,
headers
=
(
None
if
headers
is
None
else
headers
=
(
self
.
_build_headers
({})
if
headers
is
None
else
self
.
_build_headers
(
headers
)),
params
=
params
if
params
is
not
None
else
{},
**
kwargs
)
...
...
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