Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bot API 8.0:PreparedInlineMessage andBot.save_prepared_inline_message#4574

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 6 commits intoapi-8.0fromapi-8.0-preparedinlinemessage
Nov 28, 2024

Conversation

Bibo-Joshi
Copy link
Member

No description provided.

@Bibo-JoshiBibo-Joshi added the ⚙️ bot-apiaffected functionality: bot-api labelNov 24, 2024
@codecovCodecov
Copy link

codecovbot commentedNov 24, 2024
edited
Loading

❌ 1 Tests Failed:

Tests completedFailedPassedSkipped
606616065240
View the top 1 failed tests by shortest run time
tests._files.test_sticker.TestStickerSetWithRequest::test_bot_methods_1_tgs
Stack Traces | 4.37s run time
self=<tests._files.test_sticker.TestStickerSetWithRequestobjectat0x7f807160ae40>bot=PytestExtBot[token=1055397471:AAG18nB_S2WAwuJ3g7ohKBVgXXceMnIOySc]chat_id='675666224'asyncdeftest_bot_methods_1_tgs(self,bot,chat_id):awaitasyncio.sleep(1)>assertawaitbot.add_sticker_to_set(chat_id,f"animated_test_by_{bot.username}",sticker=InputSticker(sticker=data_file("telegram_animated_sticker.tgs").open("rb"),emoji_list=["#x1F604"],format=StickerFormat.ANIMATED,            ),        )tests/_files/test_sticker.py:830: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _telegram/ext/_extbot.py:910:inadd_sticker_to_setreturnawaitsuper().add_sticker_to_set(telegram/_bot.py:6570:inadd_sticker_to_setreturnawaitself._post(telegram/_bot.py:618:in_postreturnawaitself._do_post(telegram/ext/_extbot.py:352:in_do_postreturnawaitsuper()._do_post(telegram/_bot.py:647:in_do_postresult=awaitrequest.post(telegram/request/_baserequest.py:202:inpostresult=awaitself._request_wrapper(tests/auxil/networking.py:48:in_request_wrapperreturnawaitsuper()._request_wrapper(__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _self=<tests.auxil.networking.NonchalantHttpxRequestobjectat0x7f807146ee40>url='https://api.telegram.org/bot1055397471:AAG18nB_S2WAwuJ3g7ohKBVgXXceMnIOySc/addStickerToSet'method='POST'request_data=<telegram.request._requestdata.RequestDataobjectat0x7f806da8ca60>read_timeout=None,write_timeout=None,connect_timeout=Nonepool_timeout=Noneasyncdef_request_wrapper(self,url:str,method:str,request_data:Optional[RequestData]=None,read_timeout:ODVInput[float]=DEFAULT_NONE,write_timeout:ODVInput[float]=DEFAULT_NONE,connect_timeout:ODVInput[float]=DEFAULT_NONE,pool_timeout:ODVInput[float]=DEFAULT_NONE,    )->bytes:"""Wraps the real implementation request method.        Performs the following tasks:        * Handle the various HTTP response codes.        * Parse the Telegram server response.        Args:            url (:obj:`str`): The URL to request.            method (:obj:`str`): HTTP method (i.e. 'POST', 'GET', etc.).            request_data (:class:`telegram.request.RequestData`, optional): An object containing                information about parameters and files to upload for the request.            read_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum                amount of time (in seconds) to wait for a response from Telegram's server instead                of the time specified during creating of this object. Defaults to                :attr:`DEFAULT_NONE`.            write_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum                amount of time (in seconds) to wait for a write operation to complete (in terms of                a network socket; i.e. POSTing a request or uploading a file) instead of the time                specified during creating of this object. Defaults to :attr:`DEFAULT_NONE`.            connect_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the                maximum amount of time (in seconds) to wait for a connection attempt to a server                to succeed instead of the time specified during creating of this object. Defaults                to :attr:`DEFAULT_NONE`.            pool_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum                amount of time (in seconds) to wait for a connection to become available instead                of the time specified during creating of this object. Defaults to                :attr:`DEFAULT_NONE`.        Returns:            bytes: The payload part of the HTTP server response.        Raises:            TelegramError        """# Import needs to be here since HTTPXRequest is a subclass of BaseRequestfromtelegram.requestimportHTTPXRequest# pylint: disable=import-outside-toplevel# 20 is the documented default value for all the media related bot methods and custom# implementations of BaseRequest may explicitly rely on that. Hence, we follow the# standard deprecation policy and deprecate starting with version 20.7.# For our own implementation HTTPXRequest, we can handle that ourselves, so we skip the# warning in that case.has_files=request_dataandrequest_data.multipart_dataif (has_filesandnotisinstance(self,HTTPXRequest)andisinstance(write_timeout,DefaultValue)        ):warn(PTBDeprecationWarning("20.7",f"The `write_timeout` parameter passed to{self.__class__.__name__}.do_request"" will default to `BaseRequest.DEFAULT_NONE` instead of 20 in future versions ""for *all* methods of the `Bot` class, including methods sending media.",                ),stacklevel=3,            )write_timeout=20try:code,payload=awaitself.do_request(url=url,method=method,request_data=request_data,read_timeout=read_timeout,write_timeout=write_timeout,connect_timeout=connect_timeout,pool_timeout=pool_timeout,            )exceptTelegramError:raiseexceptExceptionasexc:raiseNetworkError(f"Unknown error in HTTP implementation:{exc!r}")fromexcifHTTPStatus.OK<=code<=299:# 200-299 range are HTTP success statusesreturnpayloadresponse_data=self.parse_json_payload(payload)description=response_data.get("description")message=descriptionifdescriptionelse"Unknown HTTPError"# In some special cases, we can raise more informative exceptions:# see https://core.telegram.org/bots/api#responseparameters and# https://core.telegram.org/bots/api#making-requests# TGs response also has the fields 'ok' and 'error_code'.# However, we rather rely on the HTTP status code for now.parameters=response_data.get("parameters")ifparameters:migrate_to_chat_id=parameters.get("migrate_to_chat_id")ifmigrate_to_chat_id:raiseChatMigrated(migrate_to_chat_id)retry_after=parameters.get("retry_after")ifretry_after:raiseRetryAfter(retry_after)message+=f"\nThe server response contained unknown parameters:{parameters}"ifcode==HTTPStatus.FORBIDDEN:# 403raiseForbidden(message)ifcodein (HTTPStatus.NOT_FOUND,HTTPStatus.UNAUTHORIZED):# 404 and 401# TG returns 404 Not found for#   1) malformed tokens#   2) correct tokens but non-existing method, e.g. api.tg.org/botTOKEN/unkonwnMethod# 2) is relevant only for Bot.do_api_request, where we have special handing for it.# TG returns 401 Unauthorized for correctly formatted tokens that are not validraiseInvalidToken(message)ifcode==HTTPStatus.BAD_REQUEST:# 400>raiseBadRequest(message)Etelegram.error.BadRequest:Wrongfiletypetelegram/request/_baserequest.py:383:BadRequest

To view more test analytics, go to theTest Analytics Dashboard
📢 Thoughts on this report?Let us know!

@Bibo-JoshiBibo-Joshi mentioned this pull requestNov 24, 2024
42 tasks
@Bibo-JoshiBibo-Joshi changed the titlePreparedInlineMessage andBot.save_prepared_inline_messageBot API 8.0:PreparedInlineMessage andBot.save_prepared_inline_messageNov 24, 2024
# Conflicts:#docs/source/inclusions/bot_methods.rst
@Bibo-JoshiBibo-Joshi merged commit3f83bec intoapi-8.0Nov 28, 2024
16 of 20 checks passed
@Bibo-JoshiBibo-Joshi deleted the api-8.0-preparedinlinemessage branchNovember 28, 2024 18:37
@Bibo-JoshiBibo-Joshi mentioned this pull requestNov 28, 2024
30 tasks
Copy link
Member

@PoolitzerPoolitzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 8, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@PoolitzerPoolitzerPoolitzer left review comments

Assignees
No one assigned
Labels
⚙️ bot-apiaffected functionality: bot-api
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Bibo-Joshi@Poolitzer

[8]ページ先頭

©2009-2025 Movatter.jp