V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
evilrabbit
V2EX  ›  分享创造

xhttpy: 统一的 http api 请求工具,支持流/非流、同步/异步

  •  
  •   evilrabbit · 7 天前 · 883 次点击

    requests, httpx, aiohttp……

    python 的 http 工具其实挺多,但有时候不好取舍。就写了这个统一的工具,backend 支持 httpx 和 aiohttp ,支持了流式/非流式,同步/异步,以及各种 HTTP 方法。

    地址:

    https://github.com/hscspring/xhttpy

    6 条回复    2026-01-21 00:46:52 +08:00
    est
        1
    est  
       7 天前
    httpx 就支持 流/非流、同步/异步 了吧?
    evilrabbit
        2
    evilrabbit  
    OP
       7 天前
    @est 嗯是的,不过 aiohttp 异步性能比较好,我们有时候是偏向于在 server 里使用 aiohttp 的。
    est
        3
    est  
       7 天前
    @evilrabbit 哦?性能更好有这个说法吗?有 benchmark 之类的不
    evilrabbit
        4
    evilrabbit  
    OP
       7 天前
    抱歉刚刚说的不准确,应该说某些场合下好一点。


    - [oxylabs/httpx-vs-requests-vs-aiohttp: See how HTTPX, Requests, and AIOHTTP libraries compare for sending network requests and find out which one may fit your case better.]( https://github.com/oxylabs/httpx-vs-requests-vs-aiohttp)
    - [fastapi - Why is httpx so much worse than aiohttp when facing high concurrent requests? - Stack Overflow]( https://stackoverflow.com/questions/78516655/why-is-httpx-so-much-worse-than-aiohttp-when-facing-high-concurrent-requests)
    - [httpx vs aiohttp : r/Python --- httpx vs aiohttp : r/Python]( https://www.reddit.com/r/Python/comments/ig8f3o/httpx_vs_aiohttp/)
    evilrabbit
        5
    evilrabbit  
    OP
       7 天前
    @est 总之就是什么都想要,就想把它们合并😆
    evilrabbit
        6
    evilrabbit  
    OP
       7 天前
    @evilrabbit 补充:[perf: Use aiohttp instead of httpx for high-concurrency external calls · Issue #752 · nexi-lab/nexus]( https://github.com/nexi-lab/nexus/issues/752)
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   3782 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 10:24 · PVG 18:24 · LAX 02:24 · JFK 05:24
    ♥ Do have faith in what you're doing.