File size: 828 Bytes
725c615 6ea0901 725c615 6ea0901 725c615 6ea0901 725c615 6ea0901 9df76f2 725c615 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import aiohttp
from aiohttp import web
async def proxy_handler(request):
# Extract request parameters from user's request
method = request.method
url = "https://api.telegram.org" + request.path_qs
headers = request.headers
data = await request.read()
async with aiohttp.ClientSession() as session:
# Make a request to the Telegram API
async with session.request(method, url, headers=headers, data=data) as response:
# Get response content
content = await response.read()
# Forward response from Telegram API to user
return web.Response(body=content, status=response.status, headers=response.headers)
app = web.Application()
app.router.add_route('*', '/{path:.*}', proxy_handler)
if __name__ == '__main__':
web.run_app(app,port=7860) |