日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

python 協程庫 asyncio 翻譯列表

系統 1913 0

asyncio 模塊官網連接:https://docs.python.org/zh-cn/3.7/library/asyncio.html

同步原語參考鏈接:https://mozillazg.com/2017/08/python-asyncio-note-synchronization-primitives.html

異步參考:http://python.jobbole.com/88291/

http://python.jobbole.com/87310/

http://python.jobbole.com/87541/

asyncio.gather ?and? asyncio.wait ?的區別:https://stackoverflow.com/questions/42231161/asyncio-gather-vs-asyncio-wait

aiohttp官網:https://aiohttp.readthedocs.io/en/stable/

aiohttp github:https://github.com/aio-libs/aiohttp

?

asyncio 系列一、asyncio 的協程與任務:

? ? ? ?https://blog.csdn.net/duxin_csdn/article/details/90517462

?

asyncio 系列二、asyncio 子進程:

? ? ? ??https://blog.csdn.net/duxin_csdn/article/details/90517648

?

asyncio 系列三、asyncio 隊列

? ? ? ??https://blog.csdn.net/duxin_csdn/article/details/90517781

?

asyncio 系列四、asyncio 的異常

? ? ? ??https://blog.csdn.net/duxin_csdn/article/details/90517884

?

asyncio 系列四、期程 — asyncio.Future

? ? ? ??https://blog.csdn.net/duxin_csdn/article/details/90518231

?

asyncio 系列五、同步原語—Synchronization Primitives

? ? ? ??https://blog.csdn.net/duxin_csdn/article/details/90518304

?

此外,asyncio還可以創建一個tcp、udp的服務器模型,參見官網連接:https://docs.python.org/zh-cn/3.7/library/asyncio-stream.html

?

創建http協議的服務器模型的話,需要aiohttp模塊,參見aiohttp官網:https://aiohttp.readthedocs.io/en/stable/

官網例子:

服務端:

            
              from aiohttp import web

async def handle(request):
    name = request.match_info.get('name', "Anonymous")
    text = "Hello, " + name
    return web.Response(text=text)

app = web.Application()
app.add_routes([web.get('/', handle),
                web.get('/{name}', handle)])

web.run_app(app)
            
          

客戶端:

            
              import aiohttp
import asyncio

async def fetch(session, url):
    async with session.get(url) as response:
        return await response.text()

async def main():
    async with aiohttp.ClientSession() as session:
        html = await fetch(session, 'http://python.org')
        print(html)

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
            
          

?

?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 冀州市| 临朐县| 衡南县| 台湾省| 天镇县| 鸡东县| 抚顺市| 克拉玛依市| 道孚县| 河南省| 车致| 南阳市| 泗水县| 佛学| 汽车| 耒阳市| 潮州市| 阜新市| 东丰县| 陇南市| 府谷县| 浮山县| 郸城县| 凯里市| 海城市| 衡山县| 迁西县| 广德县| 峡江县| 尚义县| 临清市| 娄底市| 普兰县| 柘荣县| 元氏县| 马关县| 新化县| 合肥市| 亳州市| 屏东县| 普格县|