1

Telethon with quart

How to use telethon with hypercorn?

How to convert the following line

app.run(loop=client.loop)

In procfile, how to pass the loop

hypercorn file:app -k asyncio

Or how to use hypercorn api?

import asyncio
from hypercorn.asyncio import serve

asyncio.run(serve(app, config)) # value for config
Tibebes. M
  • 6,940
  • 5
  • 15
  • 36
Smart Manoj
  • 5,230
  • 4
  • 34
  • 59

2 Answers2

1

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.

pgjones
  • 6,044
  • 1
  • 14
  • 12
1

Try this

import asyncio
from hypercorn.asyncio import serve

loop = client.loop
asyncio.set_event_loop(loop)

loop.run_until_complete(serve(app, config))
Umesh Chaudhary
  • 391
  • 1
  • 6
  • sample value for config ? – Smart Manoj Jul 20 '19 at 10:16
  • 1
    a config will be an object of `hypercorn.config.Config` class. Try importing this Config class and create an object based on this nice documenation https://pgjones.gitlab.io/hypercorn/source/hypercorn.config.html – Umesh Chaudhary Jul 21 '19 at 05:32