简体   繁体   English

如何在 hypercorn 中使用 Telethon?

[英]How to use telethon with hypercorn?

Telethon with quart 夸脱电视节目

How to use telethon with hypercorn?如何在 hypercorn 中使用 Telethon?

How to convert the following line如何转换以下行

app.run(loop=client.loop)

In procfile, how to pass the loop在procfile中,如何传递循环

hypercorn file:app -k asyncio

Or how to use hypercorn api?或者如何使用hypercorn api?

import asyncio
from hypercorn.asyncio import serve

asyncio.run(serve(app, config)) # value for config

If you change to,如果你改成,

import asyncio
from hypercorn.asyncio import serve

loop.run_until_complete(serve(app, config)) 

you can fully control which loop Hypercorn uses to serve the app.您可以完全控制 Hypercorn 使用哪个循环来为应用程序提供服务。

Try this尝试这个

import asyncio
from hypercorn.asyncio import serve

loop = client.loop
asyncio.set_event_loop(loop)

loop.run_until_complete(serve(app, config))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM