Skip to content

Commit

Permalink
fix(lint): change httpx get call to be friendlier with pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertRosca committed Aug 24, 2024
1 parent 9b56130 commit efeab5e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/zulip_write_only_proxy/mymdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ async def get_zulip_stream_name(self, proposal_no: int) -> str:
str: The stream name.
"""
# TODO: should use `/proposals/{number}/logbook`, but this responds with 403
res = await self.get(f"/api/proposals/by_number/{proposal_no}")

res = res.json().get("logbook_info", {}).get("logbook_identifier", None)
res = (
(await self.get(f"/api/proposals/by_number/{proposal_no}"))
.json()
.get("logbook_info", {})
.get("logbook_identifier", None)
)

if res is None:
raise NoStreamForProposalError(proposal_no)
Expand All @@ -128,9 +131,7 @@ async def get_zulip_stream_name(self, proposal_no: int) -> str:
async def get_zulip_bot_credentials(
self, proposal_no: int
) -> tuple[str | None, str | None]:
res = await self.get(f"/api/proposals/{proposal_no}/logbook_bot")

res = res.json()
res = (await self.get(f"/api/proposals/{proposal_no}/logbook_bot")).json()

if res is None:
raise NoStreamForProposalError(proposal_no)
Expand Down

0 comments on commit efeab5e

Please sign in to comment.