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

python 協(xié)程庫 asyncio 翻譯列表

系統(tǒng) 1966 0

asyncio 模塊官網(wǎng)連接: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 ?的區(qū)別:https://stackoverflow.com/questions/42231161/asyncio-gather-vs-asyncio-wait

aiohttp官網(wǎng):https://aiohttp.readthedocs.io/en/stable/

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

?

asyncio 系列一、asyncio 的協(xié)程與任務:

? ? ? ?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還可以創(chuàng)建一個tcp、udp的服務器模型,參見官網(wǎng)連接:https://docs.python.org/zh-cn/3.7/library/asyncio-stream.html

?

創(chuàng)建http協(xié)議的服務器模型的話,需要aiohttp模塊,參見aiohttp官網(wǎng):https://aiohttp.readthedocs.io/en/stable/

官網(wǎng)例子:

服務端:

            
              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())
            
          

?

?


更多文章、技術交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

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

【本文對您有幫助就好】

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

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 福贡县| 临沂市| 社会| 香港| 同心县| 平湖市| 思南县| 房山区| 新昌县| 桃源县| 永泰县| 青铜峡市| 安乡县| 奉化市| 江油市| 抚顺市| 成安县| 安塞县| 新丰县| 济南市| 乌拉特中旗| 陈巴尔虎旗| 贵南县| 永和县| 南宫市| 民勤县| 大名县| 府谷县| 宁国市| 大港区| 牟定县| 镇赉县| 黄龙县| 古交市| 莒南县| 遂昌县| 永嘉县| 眉山市| 桐梓县| 全南县| 三门峡市|