mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Implement Gone request handler
This commit is contained in:
parent
a43e196d6d
commit
9477e9af86
1 changed files with 14 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import typing
|
|||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPGone
|
||||
|
||||
from .. import types
|
||||
from ..bot import api
|
||||
|
|
@ -245,6 +246,19 @@ class WebhookRequestHandler(web.View):
|
|||
context.set_value('TELEGRAM_IP', ip_address)
|
||||
|
||||
|
||||
class GoneRequestHandler(web.View):
|
||||
"""
|
||||
If a webhook returns the HTTP error 410 Gone for all requests for more than 23 hours successively,
|
||||
it can be automatically removed.
|
||||
"""
|
||||
|
||||
async def get(self):
|
||||
raise HTTPGone()
|
||||
|
||||
async def post(self):
|
||||
raise HTTPGone()
|
||||
|
||||
|
||||
def configure_app(dispatcher, app: web.Application, path=DEFAULT_WEB_PATH):
|
||||
"""
|
||||
You can prepare web.Application for working with webhook handler.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue