Skip to content

Commit

Permalink
Enable whoising remote users
Browse files Browse the repository at this point in the history
  • Loading branch information
nexy7574 committed Jun 26, 2024
1 parent af3c2c5 commit 3cdc093
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/dendritecli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,18 @@ def whois(self, user_id: str) -> dict:
:raises: httpx.HTTPError - if the request failed.
"""
log.info("Fetching information about user %s", user_id)
domain = user_id.split(":", 1)[1]
user_id = quote(user_id)
response = self.client.get(f"/_matrix/client/v3/admin/whois/{user_id}")
url = f"/_matrix/client/v3/admin/whois/{user_id}"
if domain != self.client.base_url.host:
log.warning(
"User %s is not local to this server - will contact %r instead.",
user_id,
domain,
)
url = f"https://{domain}{url}"

response = self.client.get(url)
log.info("Done fetching information about user %s", user_id)
response.raise_for_status()
return response.json()
Expand Down

0 comments on commit 3cdc093

Please sign in to comment.