INNER CODE UNIT · Python
post_json
CassiopeiaCode/q2api · account-feeder/app.py:84
async def post_json(url: str, payload: Dict) -> httpx.Response:
"""发送 JSON POST 请求"""
payload_str = json.dumps(payload, ensure_ascii=False)
headers = make_headers()
async with httpx.AsyncClient(proxies=_get_proxies(), timeout=60.0) as client:
resp = await client.post(url, headers=headers, content=payload_str)
return resp
async def register_client() -> tuple[str, str]:
"""注册 OIDC 客户端"""
payload = {
"clientName": "Amazon Q Developer for command line",
"clientType": "public",
"scopes": [
"codewhisperer:completions",
"codewhisperer:analysis",
"codewhisperer:conversations",