Python async/await 的协程 怎么取到返回值呢?
資深大佬 : PPTX 8
async def SendHttpReq(url, method, params=None, data=None, headers=None,verify=None, cert=None, json_data=None): async with httpx.AsyncClient() as client: if (method == "GET"): response = await client.get(url) return response
比如我外部函数想调用这个 SendHttpReq,取到 response 。这个不能直接像函数一样 resp = SendHttpReq()。
大佬有話說 (5)