fix(lint): use httpx.AsyncClient instead of sync requests
This commit is contained in:
@@ -464,12 +464,12 @@ async def _handle_issue_comment(payload: Dict[str, Any]) -> None:
|
||||
sha_match = re.search(r"commit:\s*`?([0-9a-f]{40})`?", body)
|
||||
if sha_match:
|
||||
try:
|
||||
resp = requests.get(
|
||||
f"{_GITEA_BASE}/commits/{sha_match.group(1)}/status",
|
||||
headers={"Authorization": f"token {_GITEA_TOKEN}"},
|
||||
timeout=5,
|
||||
)
|
||||
if resp.ok:
|
||||
async with httpx.AsyncClient(timeout=5.0) as client:
|
||||
resp = await client.get(
|
||||
f"{_GITEA_BASE}/commits/{sha_match.group(1)}/status",
|
||||
headers={"Authorization": f"token {_GITEA_TOKEN}"},
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
statuses = resp.json().get("statuses", [])
|
||||
for s in statuses:
|
||||
if s.get("status") == "failure" or s.get("state") == "failure":
|
||||
|
||||
Reference in New Issue
Block a user