from app.infra.shared import AsyncHttpClient # 抓取公众号粉丝 async def get_gzh_stat_daily(access_token: str, date_string: str): url = f"https://api.weixin.qq.com/datacube/getarticletotaldetail?access_token={access_token}" data = {"begin_date": date_string, "end_date": date_string} headers = { "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36", "Content-Type": "application/json", } # 发送请求 async with AsyncHttpClient(timeout=10) as http_client: response = await http_client.post(url, headers=headers, json=data) return response