Small refactoring
This commit is contained in:
parent
3c5ba516af
commit
0ac3c5e55f
2 changed files with 11 additions and 21 deletions
|
@ -300,6 +300,7 @@ Release Notes
|
||||||
-------------
|
-------------
|
||||||
**Version 3.14.1**
|
**Version 3.14.1**
|
||||||
* Fixed issue during coping and moving files with cyrillic names
|
* Fixed issue during coping and moving files with cyrillic names
|
||||||
|
* Support OAuth2 bearer tokens by https://github.com/danielloader
|
||||||
|
|
||||||
**Version 3.14**
|
**Version 3.14**
|
||||||
* Override methods for customizing communication with WebDAV servers
|
* Override methods for customizing communication with WebDAV servers
|
||||||
|
|
|
@ -211,21 +211,10 @@ class Client(object):
|
||||||
"""
|
"""
|
||||||
if self.session.auth:
|
if self.session.auth:
|
||||||
self.session.request(method="GET", url=self.webdav.hostname, verify=self.verify) # (Re)Authenticates against the proxy
|
self.session.request(method="GET", url=self.webdav.hostname, verify=self.verify) # (Re)Authenticates against the proxy
|
||||||
if all([self.webdav.login, self.webdav.password]) is False:
|
|
||||||
response = self.session.request(
|
response = self.session.request(
|
||||||
method=self.requests[action],
|
method=self.requests[action],
|
||||||
url=self.get_url(path),
|
url=self.get_url(path),
|
||||||
headers=self.get_headers(action, headers_ext),
|
auth=(self.webdav.login, self.webdav.password) if not self.webdav.token else None,
|
||||||
timeout=self.timeout,
|
|
||||||
data=data,
|
|
||||||
stream=True,
|
|
||||||
verify=self.verify
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
response = self.session.request(
|
|
||||||
method=self.requests[action],
|
|
||||||
url=self.get_url(path),
|
|
||||||
auth=(self.webdav.login, self.webdav.password),
|
|
||||||
headers=self.get_headers(action, headers_ext),
|
headers=self.get_headers(action, headers_ext),
|
||||||
timeout=self.timeout,
|
timeout=self.timeout,
|
||||||
data=data,
|
data=data,
|
||||||
|
|
Loading…
Add table
Reference in a new issue