Skip to content

Commit 5334181

Browse files
Ran tox -e style
1 parent 25488b1 commit 5334181

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

caldav/davclient.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def __init__(
462462
Parameters:
463463
* url: A fully qualified url: `scheme://user:pass@hostname:port`
464464
* proxy: A string defining a proxy server: `hostname:port`
465-
* auth: A niquests.auth.AuthBase or requests.auth.AuthBase object.
465+
* auth: A niquests.auth.AuthBase or requests.auth.AuthBase object.
466466
Use when the server's auth scheme is known.
467467
Otherwise, pass username and password instead.
468468
* username and password should be passed as arguments or in the URL
@@ -475,9 +475,9 @@ def __init__(
475475
username and password may be omitted. Known bugs:
476476
- .netrc is honored even if a username/password is given,
477477
ref https://github.com/python-caldav/caldav/issues/206
478-
- If the caldav server is behind a proxy or replies with html instead of xml
478+
- If the caldav server is behind a proxy or replies with html instead of xml
479479
when returning 401, warnings will be printed which might be unwanted.
480-
Check auth parameter for details.
480+
Check auth parameter for details.
481481
"""
482482
headers = headers or {}
483483

@@ -833,21 +833,28 @@ def request(
833833
cert=self.ssl_cert,
834834
)
835835
log.debug("server responded with %i %s" % (r.status_code, r.reason))
836-
if r.status_code == 401 and 'text/html' in self.headers.get("Content-Type", "") and not self.auth:
836+
if (
837+
r.status_code == 401
838+
and "text/html" in self.headers.get("Content-Type", "")
839+
and not self.auth
840+
):
837841
# The server can return HTML on 401 sometimes (ie. it's behind a proxy)
838842
# The user can avoid logging errors by setting the authentication type by themselves.
839843
msg = (
840844
"No authentication object was provided. "
841845
"HTML was returned when probing the server for supported authentication types. "
842846
"To avoid logging errors, consider setting the authentication type manually via DAVClient(auth=...)"
843847
)
844-
if r.headers.get("WWW-Authenticate"):
848+
if r.headers.get("WWW-Authenticate"):
845849
auth_types = [
846-
t for t in self.extract_auth_types(r.headers["WWW-Authenticate"])
847-
if t in ["basic", "digest", "bearer"]
850+
t
851+
for t in self.extract_auth_types(r.headers["WWW-Authenticate"])
852+
if t in ["basic", "digest", "bearer"]
848853
]
849854
if auth_types:
850-
msg += "\nSupported authentication types: %s" % (", ".join(auth_types))
855+
msg += "\nSupported authentication types: %s" % (
856+
", ".join(auth_types)
857+
)
851858
log.warning(msg)
852859
response = DAVResponse(r, self)
853860
except:

0 commit comments

Comments
 (0)