Skip to content

Commit 4125b79

Browse files
DarthMaxadamnsch
andcommitted
Address review comments
Co-Authored-By: Adam Schill Collberg <adam.schill.collberg@protonmail.com>
1 parent ef41872 commit 4125b79

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

graphdatascience/query_runner/arrow_query_runner.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ def __init__(self, factory: AuthFactory, *args: Any, **kwargs: Any) -> None:
125125

126126
def received_headers(self, headers: Dict[str, Any]) -> None:
127127
auth_header: str = headers.get("Authorization", None)
128-
if auth_header is not None:
129-
[auth_type, token] = auth_header.split(" ", 1)
130-
if auth_type == "Bearer":
131-
self._factory.set_token(token)
128+
if not auth_header:
129+
return
130+
[auth_type, token] = auth_header.split(" ", 1)
131+
if auth_type == "Bearer":
132+
self._factory.set_token(token)
132133

133134
def sending_headers(self) -> Dict[str, str]:
134135
token = self._factory.token()
135-
if token is None:
136+
if not token:
136137
username, password = self._factory.auth
137-
auth_token = "{0}:{1}".format(username, password)
138+
auth_token = f"{username}:{password}"
138139
auth_token = "Basic " + base64.b64encode(auth_token.encode("utf-8")).decode("ASCII")
139140
# There seems to be a bug, `authorization` must be lower key
140141
return {"authorization": auth_token}
141142
else:
142-
# # There seems to be a bug, `authorization` must be lower key
143143
return {"authorization": "Bearer " + token}

0 commit comments

Comments
 (0)