The order of Union types for media properties in various files was
reversed to `Union[str, InputFile]` for consistency. The changes were
made in the following files:
- aiogram/types/input_media_video.py
- aiogram/types/input_media_audio.py
- aiogram/types/input_media_document.py
- aiogram/types/input_media_animation.py
- aiogram/types/input_media_photo.py
- aiogram/utils/media_group.py
fix: update type check in base.py for TelegramObject (dev-3)
Replaced BotContextController with TelegramObject in the type check to
ensure proper handling of non-standard objects.
test: add TODO comments in test files (dev-3)
Added TODO comments to highlight parts of the code that need future
improvements in the following test files:
- tests/test_api/test_types/test_input_file.py
- tests/test_api/test_client/test_session/test
Refactored various InputMedia types to support Union[InputFile, str] for
media properties, enhancing flexibility and unifying input data types.
- Modified media_group.py for AUDIO, PHOTO, VIDEO, and DOCUMENT.
- Updated input_media_document.py and input_media_audio.py
to use Union[InputFile, str].
- Adjusted bot.py to utilize DateTime for close_date.
- Refactored aiohttp session for better file handle and serialization.
- Enhanced set_chat_photo.py to accept Union[InputFile, str].
- Re-organized input_file.py with modern BaseModel features.
- Added new client/form module for splitting file extraction logic.
- Adapted test cases to validate the new structure and behavior.
* Add voter_chat to poll_answer event handling
The change ensures that when a poll_answer event is processed, the user context middleware now also returns the chat where the vote took place. Previously, only the user who cast the vote was returned.
* Added changelog
* Fixed tests
* Bump Python version in test
Three properties of the Bot class - parse_mode, disable_web_page_preview, and protect_content - have been marked as deprecated with proper warning messages. The associated tests have also been added to confirm the working of these deprecation warnings. Users are advised to use the updated alternatives specified in the warning messages.
* #1320 Update pytest configuration and tests cleanup
This commit modifies the pytest's configuration file, `pyproject.toml`, to remove filterwarnings settings. It also makes changes in various test files; the Redis isolation test is now using the provided `redis_storage` fixture instead of setting up its own connection, pytest.mark.filterwarnings is no longer used in `test_isolation.py` and `test_aiohttp_session.py` properly closes off sessions.
* Added changelog
* Fixed coverage for the RedisEventIsolation
* PoC: Mount objects to the Bot instance, bind shortcuts to configured instance
* Fixe docstring of the bind method
* Pass Bot instance explicitly to the URLInputFile
* Added tests
* Added changelog
* Refactor aiogram client and update tests
Refactored base.py to improve code readability by separating response_type operation from model_validate(). Also, adjusted the parameters in URLInputFile() within test_input_file.py for better test coverage. Updated input_file.py to streamline read method and avoid unnecessary instantiation of Bot class. Lastly, adjusted typing in methods/base.py to enhance code clarity.
* Update changelog
* Check status code when downloading file and raise an error if someting bad happends
* Style fixes
* Add doc
* Use "towncrier create <issue>.<type>" for creating file
* Rework middlewares, separate management to `MiddlewareManager` class
* Rework middlewares
* Added changes description for redis
* Added changes description for redis
* Fixed tests with Redis // aioredis replacement
* Changed msg.<html/md>_text attributes behaviour
* Added changelog for spoilers
* Added possibility to get command magic result as handler arguments
Upgrade architecture + 5.0 Bot API (#469)
* Moved `methods`, `types` and `client` to root package
* Removed update handler from routers to dispatcher
* Reworked events propagation mechanism to handlers
* Reworked inner middlewares logic (very small change)
* Updated to Bot API 5.0
* Initial migration from MkDocs to Sphinx + config for readthedocs
* fix(aiohttp-session): respect UNSET sentinel
check if value is `UNSET` while building http request.
* Cover UNSET by tests
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
* feat(helpers): implement new descriptor with default value getter
* perf(descriptor): use weakref
refuse weak reference to a value in WeakRefDict instead of polluting instance namespace
* chore(descriptor): rename descriptor class
rename `DefaultProperty` to `Default`
* style(fmt): lint code
* feat(proxy): proxy for aiohttp,base sessions
Add support for proxies in aiohttp session with aiohttp_socks library,
edit BaseSession class to support proxies for other sessions in future.
* fix(annotation): missing underscore before "private" typevar
* chore: remove redundant of proxy_url schema for socks version
* test: add missing test
Add missing test, remove BaseSession.cfg and switch to
implementing class' "private" traits, add aiohttp_socks in dependency list as
optional and extra.
* feat(session):
Implement asyncio session for requests [wip]
* feat(proxy chain): Chained proxy support in aiohttp session
Add ChainProxyConnector support, !pin pydantic to "1.4", add
documentation on aiohttp connector.
* style(mypy): apply linter changes
* tests(mock): remove await for magic mock
* fix dangling dependency
* refactor(generic):
get rid of generic behaviour for base session