python异步请求:一开始写的代码是直接加了async,结果两个函数的请求仍是同步的,单个请求耗时0.3s,两个耗时0.7s。后经调研,发现,需要使用aiohttp请求,才可以实现真正的异步。优化后,总耗时0.4-0.5s左右。
Miles

Miles @btcmiles

About: Blockchain engineer focused on on-chain data, scraping, quant trading, and backend development. Proficient in Python and passionate about exploring the limits of Web3 and smart contracts.

Location:
Hong Kong
Joined:
Apr 22, 2025

python异步请求:一开始写的代码是直接加了async,结果两个函数的请求仍是同步的,单个请求耗时0.3s,两个耗时0.7s。后经调研,发现,需要使用aiohttp请求,才可以实现真正的异步。优化后,总耗时0.4-0.5s左右。

Publish Date: Apr 29
0 0

Comments 0 total

    Add comment