mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Implemented new one InputFile interface for sending local files.
This commit is contained in:
parent
751929cb1d
commit
753396330d
4 changed files with 149 additions and 31 deletions
|
|
@ -5,6 +5,7 @@ from http import HTTPStatus
|
|||
|
||||
import aiohttp
|
||||
|
||||
from .. import types
|
||||
from ..utils import exceptions
|
||||
from ..utils import json
|
||||
from ..utils.helper import Helper, HelperMode, Item
|
||||
|
|
@ -113,6 +114,8 @@ def _compose_data(params=None, files=None):
|
|||
filename, fileobj = f
|
||||
else:
|
||||
raise ValueError('Tuple must have exactly 2 elements: filename, fileobj')
|
||||
elif isinstance(f, types.InputFile):
|
||||
filename, fileobj = f.get_filename(), f.get_file()
|
||||
else:
|
||||
filename, fileobj = _guess_filename(f) or key, f
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue