Skip to content

Reworked request builder #1142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 11, 2023
Merged

Reworked request builder #1142

merged 7 commits into from
Mar 11, 2023

Conversation

JrooTJunior
Copy link
Member

@JrooTJunior JrooTJunior commented Mar 11, 2023

Description

Reworked request builder.

Simplified/unified internal mechanism how request data is passed to the HTTP endpoint.
The main change is removing build_request method from each API method and all special cases (files and global defaults) is resolved inside client session before sent request.

Also new global defaults is added to the bot instance, this properties works in the same way as global parse_mode:

  • disable_web_page_preview
  • protect_content

This change should not affect you if you are writing bots, but if you do a implementing HTTP session provider or uses session internals it can break your code (because it's internal mechanism and mostly should not be used from outside of framework internals)

Type of change

Please delete options that are not relevant.

  • Internal improvements
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@JrooTJunior JrooTJunior added enhancement Make it better! 3.x Issue or PR for stable 3.x version labels Mar 11, 2023
@JrooTJunior JrooTJunior added this to the 3.0 milestone Mar 11, 2023
@JrooTJunior JrooTJunior self-assigned this Mar 11, 2023
@github-actions
Copy link

github-actions bot commented Mar 11, 2023

✔️ Changelog found.

Thank you for adding a description of the changes

@codecov
Copy link

codecov bot commented Mar 11, 2023

Codecov Report

Merging #1142 (10aff59) into dev-3.x (924a839) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           dev-3.x     #1142    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          354       354            
  Lines         9065      8791   -274     
==========================================
- Hits          9065      8791   -274     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiogram/client/bot.py 100.00% <100.00%> (ø)
aiogram/client/session/aiohttp.py 100.00% <100.00%> (ø)
aiogram/client/session/base.py 100.00% <100.00%> (ø)
aiogram/dispatcher/dispatcher.py 100.00% <100.00%> (ø)
aiogram/methods/add_sticker_to_set.py 100.00% <100.00%> (ø)
aiogram/methods/answer_callback_query.py 100.00% <100.00%> (ø)
aiogram/methods/answer_inline_query.py 100.00% <100.00%> (ø)
aiogram/methods/answer_pre_checkout_query.py 100.00% <100.00%> (ø)
aiogram/methods/answer_shipping_query.py 100.00% <100.00%> (ø)
aiogram/methods/answer_web_app_query.py 100.00% <100.00%> (ø)
... and 130 more

@JrooTJunior JrooTJunior marked this pull request as ready for review March 11, 2023 18:46
@JrooTJunior JrooTJunior merged commit fea1b7b into dev-3.x Mar 11, 2023
@JrooTJunior JrooTJunior deleted the reworked-request-builder branch August 14, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version enhancement Make it better!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant