mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Deprecate temp sessions.
This commit is contained in:
parent
8f9240f7ea
commit
a941a00abc
1 changed files with 3 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ from typing import Dict, List, Optional, Union
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import certifi
|
import certifi
|
||||||
|
|
||||||
|
from aiogram.utils.deprecated import deprecated
|
||||||
from . import api
|
from . import api
|
||||||
from ..types import ParseMode, base
|
from ..types import ParseMode, base
|
||||||
from ..utils import json
|
from ..utils import json
|
||||||
|
|
@ -93,6 +94,7 @@ class BaseBot:
|
||||||
if not session.closed:
|
if not session.closed:
|
||||||
await session.close()
|
await session.close()
|
||||||
|
|
||||||
|
@deprecated('Manually you may use `aiohttp.ClientSession` instead of temp session')
|
||||||
def create_temp_session(self, limit: base.Integer = 1, force_close: base.Boolean = False) -> aiohttp.ClientSession:
|
def create_temp_session(self, limit: base.Integer = 1, force_close: base.Boolean = False) -> aiohttp.ClientSession:
|
||||||
"""
|
"""
|
||||||
Create temporary session
|
Create temporary session
|
||||||
|
|
@ -110,6 +112,7 @@ class BaseBot:
|
||||||
self._temp_sessions.append(session)
|
self._temp_sessions.append(session)
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
@deprecated('Manually you may use `aiohttp.ClientSession` instead of temp session')
|
||||||
async def destroy_temp_session(self, session: aiohttp.ClientSession):
|
async def destroy_temp_session(self, session: aiohttp.ClientSession):
|
||||||
"""
|
"""
|
||||||
Destroy temporary session
|
Destroy temporary session
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue