Implement Gone request handler

This commit is contained in:
Alex Root Junior 2018-07-29 03:12:21 +03:00
parent a43e196d6d
commit 9477e9af86

View file

@ -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.