Skip to content

Commit 5fb36eb

Browse files
committed
oidc-exchange: reflow
Signed-off-by: William Woodruff <[email protected]>
1 parent a07ffae commit 5fb36eb

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

oidc-exchange.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,34 +100,35 @@ def get_normalized_input(name: str) -> str | None:
100100
)
101101

102102
if not mint_token_resp.ok:
103-
message = "Token request failed"
104103
try:
105104
error_payload = mint_token_resp.json()
106105
except requests.JSONDecodeError:
107106
# Token exchange failure normally produces a JSON error response, but
108107
# we might have hit a server error instead.
109-
message = dedent(
110-
f"""
111-
{message}: the index produced an unexpected {mint_token_resp.status_code} response.
112-
113-
This strongly suggests a server configuration or downtime issue; wait
114-
a few minutes and try again.
115-
"""
108+
die(
109+
dedent(
110+
f"""
111+
Token request failed: the index produced an unexpected {mint_token_resp.status_code} response.
112+
113+
This strongly suggests a server configuration or downtime issue; wait
114+
a few minutes and try again.
115+
"""
116+
)
116117
)
117-
die(message)
118118

119119
reasons = "\n".join(
120120
f"* `{error['code']}`: {error['description']}"
121121
for error in error_payload["errors"]
122122
)
123123

124-
message = f"""
125-
{message}: the server refused the request for the following reasons:
124+
# NOTE: Can't `dedent(...)` here because `reasons` is newline-delimited.
125+
die(
126+
f"""
127+
Token request failed: the server refused the request for the following reasons:
126128
127129
{reasons}
128-
"""
129-
130-
die(message)
130+
"""
131+
)
131132

132133
mint_token_payload = mint_token_resp.json()
133134
pypi_token = mint_token_payload.get("token")

0 commit comments

Comments
 (0)