Skip to content

Commit

Permalink
fix: do not pass both authentication and token when token exists. Pas…
Browse files Browse the repository at this point in the history
…s only token
  • Loading branch information
davidkleiven committed Aug 23, 2024
1 parent 078b62c commit be46aeb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cimsparql/graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ def parameters(self) -> dict[str, bool | int | None]:

@property
def auth(self) -> httpx.BasicAuth | None:
return httpx.BasicAuth(self.user, self.passwd) if self.user and self.passwd else None
return (
httpx.BasicAuth(self.user, self.passwd)
if self.user and self.passwd and not self.token
else None
)


# Available formats from RDF4J API
Expand Down Expand Up @@ -182,7 +186,7 @@ def __init__(
self.sparql.setReturnFormat(JSON)
self.sparql.setMethod(POST)
if self.service_cfg.token:
self.sparql.addCustomHttpHeader("authorization", self.service_cfg.token)
self.sparql.addCustomHttpHeader("Authorization", self.service_cfg.token)
else:
self.sparql.setCredentials(self.service_cfg.user, self.service_cfg.passwd)
if self.service_cfg.timeout:
Expand Down

0 comments on commit be46aeb

Please sign in to comment.