MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / webhook

Function webhook

examples/asynchronous_telebot/multibot/main.py:15–32  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

13
14
15async def webhook(request):
16 token = request.match_info.get('token')
17 if not tokens.get(token):
18 return web.Response(status=404)
19
20 if request.headers.get('content-type') != 'application/json':
21 return web.Response(status=403)
22
23 json_string = await request.json()
24 update = types.Update.de_json(json_string)
25 if token == main_bot.token:
26 await main_bot.process_new_updates([update])
27 return web.Response()
28
29 from_update_bot = AsyncTeleBot(token)
30 register_handlers(from_update_bot)
31 await from_update_bot.process_new_updates([update])
32 return web.Response()
33
34
35app.router.add_post("/" + config.WEBHOOK_PATH + "/{token}", webhook)

Callers

nothing calls this directly

Calls 7

process_new_updatesMethod · 0.95
AsyncTeleBotClass · 0.90
register_handlersFunction · 0.90
jsonMethod · 0.80
getMethod · 0.45
de_jsonMethod · 0.45
process_new_updatesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…