国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

Python中使用aiohttp模擬服務器出現錯誤

瀏覽:2日期:2022-07-06 16:33:42

軟件版本及環境:Python 3.9 + pycharm 2020.2.1 + Windows10 運行報錯: DeprecationWarning: loop argument is deprecatedapp = web.Application(loop=loop)DeprecationWarning: Application.make_handler(…) is deprecated, use AppRunner API insteadsrv = await loop.create_server(app.make_handler(), ‘127.0.0.1’, 8000) 出錯代碼

async def init(loop): app = web.Application(loop=loop) app.router.add_route(’GET’, ’/’, index) app.router.add_route(’GET’, ’/hello/{name}’, hello) srv = await loop.create_server(app.make_handler(), ’127.0.0.1’, 8000) print('Server started at http://127.0.0.1:8000...') return srv

解決方法 刪除loop=loop

app = web.Application()

將app.make_handler()改為app()

srv = await loop.create_server(app(), ’127.0.0.1’, 8000)

運行結果

Server started at http://127.0.0.1:8000...

出錯原因

新版本改動了庫函數的使用

到此這篇關于Python中使用aiohttp模擬服務器出現錯誤的文章就介紹到這了,更多相關Python中使用aiohttp模擬服務器出現錯誤內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 临猗县| 城口县| 五指山市| 永和县| 蚌埠市| 永昌县| 荆州市| 梁山县| 卓尼县| 永康市| 石棉县| 鹤岗市| 漯河市| 达尔| 登封市| 虎林市| 望城县| 桦川县| 黔西| 三原县| 蓝田县| 和田市| 涞水县| 胶南市| 高邮市| 普定县| 淅川县| 罗山县| 乾安县| 逊克县| 永丰县| 华阴市| 东阳市| 博罗县| 红河县| 新宾| 黄龙县| 攀枝花市| 涞源县| 桐乡市| 南丰县|