(request)
| 13 | |
| 14 | |
| 15 | async 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 | |
| 35 | app.router.add_post("/" + config.WEBHOOK_PATH + "/{token}", webhook) |
nothing calls this directly
no test coverage detected
searching dependent graphs…