INNER CODE UNIT · Python

make_headers

CassiopeiaCode/q2api · account-feeder/app.py:73

def make_headers() -> Dict[str, str]:
    """生成 OIDC 请求头"""
    return {
        "content-type": "application/json",
        "user-agent": USER_AGENT,
        "x-amz-user-agent": X_AMZ_USER_AGENT,
        "amz-sdk-request": AMZ_SDK_REQUEST,
        "amz-sdk-invocation-id": str(uuid.uuid4()),
    }


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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…