Commit graph

38 commits

Author SHA1 Message Date
Alex Root Junior
98780dfb49
Added model validation to remove UNSET before field validation (#1233)
* Add model validation to remove UNSET before field validation

Updated aiogram/types/base.py to include a model validator which removes any 'UNSET' before field validation. This change was necessary to correctly handle `parse_mode` where 'UNSET' is used as a sentinel value. Without the removal of 'UNSET', it would create issues when passed to model initialization from `Bot.method_name`. 'UNSET' was also added to typing. Tiny documentation fix was made.

* Added changelog
2023-07-30 00:01:23 +03:00
Alex Root Junior
2ecf9cefd7
Removed the use of the context instance (Bot.get_current) from all placements that were used previously. (#1230)
* Removed the use of the context instance (Bot.get_current) from all placements that were used previously.

* Fixed tests

* Added changelog

* Change category
2023-07-28 22:23:32 +03:00
Alex Root Junior
fcf9454e13
Merge branch 'Latand/dev-3.x' into dev-3.x 2023-07-17 03:11:32 +03:00
Alex Root Junior
5236329521
Update hints 2023-07-17 03:09:36 +03:00
Alex Root Junior
a7b92bb050
PoC: Bot instance inside method shortcuts using pydantic Validation Context (#1210)
* 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
2023-07-11 23:17:26 +03:00
Alex Root Junior
461e59bbdd
Update pydantic to V2 (#1202)
* Update pydantic, fix errors and warnings (all?)

* Fixed typehints

* Reformat code, removed unused imports

* Fixed typing extensions version compatibility

* Fixed coverage

* Describe changes

* Regen code
2023-07-02 15:07:19 +03:00
Alex Root Junior
fea1b7b0a3
Reworked request builder (#1142)
* Reworked request builder

* Added more default values

* Update tests

* Fixed timestamp

* Fixed Py3.8 support

* Describe changes
2023-03-11 20:46:36 +02:00
Alex Root Junior
4008a3114d
Upgrade architecture + 5.0 Bot API (#469)
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
2021-01-26 21:20:52 +02:00
jrootjunior
bdae5fb026 Clean project 2019-11-15 12:17:57 +02:00
dark0ghost
675def5013 add typing 2019-10-29 01:37:36 +03:00
Alex RootJunior
25bdb9cf4d Fix #117: TypeError with LazyProxy object in keyboards 2019-04-07 14:13:54 +03:00
Oleg A
4e4bbdfc7e Raise Exception if there's no bot instance in context 2019-02-25 13:23:50 +03:00
Alex Root Junior
39c333251f Rewrite contextvar usage. Implemented ContextInstanceMixin and DataMixin 2018-10-20 15:55:57 +03:00
Alex Root Junior
06fbe0d9cd Remove context util. 2018-06-25 01:31:57 +03:00
Alex Root Junior
8086a120c2 Try to use contextvars (partial) 2018-06-23 17:39:24 +03:00
Alex Root Junior
531b2a4df7 Hashable TelegramObject 2018-02-23 13:19:23 +02:00
Alex Root Junior
8490306096 Refactor types. 2018-01-24 02:29:48 +02:00
Alex Root Junior
2656cab2f1 TelegramObject is iterable. 2018-01-10 19:38:41 +02:00
Alex Root Junior
62d5dda84d Change error message for missing keys in the context. 2017-12-22 05:35:31 +02:00
Alex Root Junior
787ebe3e63 Set default values for not specified fields in payload. // TelegramObject 2017-11-28 17:22:46 +02:00
Alex Root Junior
753396330d Implemented new one InputFile interface for sending local files. 2017-11-21 20:31:35 +02:00
Alex Root Junior
4bf5409295 Fix object item assignment. 2017-10-21 20:56:48 +03:00
Alex Root Junior
dcbaa6d561 Oops. Dict is mutable object. Fix it. (values) 2017-10-21 20:26:38 +03:00
Alex Root Junior
f3c39ed9f1 Allow to disable ujson 2017-10-20 11:11:01 +03:00
Alex Root Junior
84c8548ceb New types (In process...) 2017-10-12 16:43:23 +03:00
Alex Root Junior
d98566bf7f Bot getter in TelegramObject. 2017-09-27 16:18:55 +03:00
Alex Root Junior
14d250bfbd Move base types to base module. 2017-09-27 15:56:06 +03:00
Alex Root Junior
9b96133b7a Move skeleton for new types from https://bitbucket.org/illemius/demo_telegramobject 2017-09-27 08:58:37 +03:00
Alex Root Junior
38bad5454e Fix date parser. 2017-08-15 03:43:27 +03:00
Alex Root Junior
33f7f0018e Fix parsing date in Deserializable objects. 2017-08-05 04:15:16 +03:00
Alex Root Junior
7c19634379 Use json util instead of std json 2017-07-29 03:35:55 +03:00
Alex Root Junior
9e894cf06b I think it will always be valid. (remove Deserializable.check_json) 2017-07-29 03:24:50 +03:00
Alex Root Junior
92253ba77a Use positional only format. 2017-07-25 04:45:33 +03:00
Alex Root Junior
5b87708049 Provide some actions from data types. 2017-07-12 00:16:29 +03:00
Alex Root Junior
595caaa458 Mooore doc's. 2017-06-04 14:37:34 +03:00
Alex Root Junior
765741e122 Modify dispatcher. Add some handlers. 2017-06-02 08:50:23 +03:00
Alex Root Junior
f3723ba378 Payments. 2017-06-02 05:53:24 +03:00
Alex Root Junior
07c7c1f32a Refactoring. 2017-06-02 03:01:28 +03:00