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: AddBot.set_user_emoji_status#4572

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 3 commits intoapi-8.0fromapi-8.0-set-user-emoji-status
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
@Bibo-JoshiBibo-Joshi mentioned this pull requestNov 24, 2024
42 tasks
@Bibo-JoshiBibo-Joshi changed the titleAddBot.set_user_emoji_statusBot API 8.0: AddBot.set_user_emoji_statusNov 24, 2024
@codecovCodecov
Copy link

codecovbot commentedNov 28, 2024

❌ 2 Tests Failed:

Tests completedFailedPassedSkipped
603626034268
View the top 2 failed tests by shortest run time
tests.ext.test_updater.TestUpdater::test_webhook_basic[None-None-False-True]
Stack Traces | 0.126s run time
self=<tests.ext.test_updater.TestUpdaterobjectat0x000002D56DB42C90>monkeypatch=<_pytest.monkeypatch.MonkeyPatchobjectat0x000002D570BB3B50>updater=Updater[bot=PytestExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]]drop_pending_updates=False,ext_bot=True,secret_token=None,unix=Nonefile_path='D:\\a\\python-telegram-bot\\python-telegram-bot\\tests\\data\\test.sock'one_time_bot=PytestExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]one_time_raw_bot=PytestBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]@pytest.mark.parametrize("ext_bot", [True,False])@pytest.mark.parametrize("drop_pending_updates", [True,False])@pytest.mark.parametrize("secret_token", ["SecretToken",None])@pytest.mark.parametrize("unix", [None,"file_path","socket_object"]ifUNIX_AVAILABLEelse [None]    )asyncdeftest_webhook_basic(self,monkeypatch,updater,drop_pending_updates,ext_bot,secret_token,unix,file_path,one_time_bot,one_time_raw_bot,    ):# Testing with both ExtBot and Bot to make sure any logic in WebhookHandler# that depends on this distinction worksifext_botandnotisinstance(updater.bot,ExtBot):updater.bot=one_time_botifnotext_botandtype(updater.bot)isnotBot:updater.bot=one_time_raw_botasyncdefdelete_webhook(*args,**kwargs):# Dropping pending updates is done by passing the parameter to delete_webhookifkwargs.get("drop_pending_updates"):self.message_count+=1returnTruemonkeypatch.setattr(updater.bot,"set_webhook",return_true)monkeypatch.setattr(updater.bot,"delete_webhook",delete_webhook)ip="127.0.0.1"port=randrange(1024,49152)# Select random portasyncwithupdater:ifunix:socket=file_pathifunix=="file_path"elsebind_unix_socket(file_path)return_value=awaitupdater.start_webhook(drop_pending_updates=drop_pending_updates,secret_token=secret_token,url_path="TOKEN",unix=socket,webhook_url="string",                )else:>return_value=awaitupdater.start_webhook(drop_pending_updates=drop_pending_updates,ip_address=ip,port=port,url_path="TOKEN",secret_token=secret_token,webhook_url="string",                )tests\ext\test_updater.py:741:__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _telegram\ext\_updater.py:594:instart_webhookawaitself._start_webhook(telegram\ext\_updater.py:686:in_start_webhookawaitself._httpd.serve_forever(ready=ready)telegram\ext\_utils\webhookhandler.py:92:inserve_foreverself._http_server.listen(self.port,address=self.listen)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\tornado\tcpserver.py:183:inlistensockets=bind_sockets(__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _port=1801,address='127.0.0.1',family=<AddressFamily.AF_UNSPEC:0>backlog=128,flags=<AddressInfo.AI_PASSIVE:1>,reuse_port=Falsedefbind_sockets(port:int,address:Optional[str]=None,family:socket.AddressFamily=socket.AF_UNSPEC,backlog:int=_DEFAULT_BACKLOG,flags:Optional[int]=None,reuse_port:bool=False,    )->List[socket.socket]:"""Creates listening sockets bound to the given port and address.        Returns a list of socket objects (multiple sockets are returned if        the given address maps to multiple IP addresses, which is most common        for mixed IPv4 and IPv6 use).        Address may be either an IP address or hostname.  If it's a hostname,        the server will listen on all IP addresses associated with the        name.  Address may be an empty string or None to listen on all        available interfaces.  Family may be set to either `socket.AF_INET`        or `socket.AF_INET6` to restrict to IPv4 or IPv6 addresses, otherwise        both will be used if available.        The ``backlog`` argument has the same meaning as for        `socket.listen() <socket.socket.listen>`.        ``flags`` is a bitmask of AI_* flags to `~socket.getaddrinfo`, like        ``socket.AI_PASSIVE | socket.AI_NUMERICHOST``.        ``reuse_port`` option sets ``SO_REUSEPORT`` option for every socket        in the list. If your platform doesn't support this option ValueError will        be raised.        """ifreuse_portandnothasattr(socket,"SO_REUSEPORT"):raiseValueError("the platform doesn't support SO_REUSEPORT")sockets= []ifaddress=="":address=Noneifnotsocket.has_ipv6andfamily==socket.AF_UNSPEC:# Python can be compiled with --disable-ipv6, which causes# operations on AF_INET6 sockets to fail, but does not# automatically exclude those results from getaddrinfo# results.# http://bugs.python.org/issue16208family=socket.AF_INETifflagsisNone:flags=socket.AI_PASSIVEbound_port=Noneunique_addresses=set()# type: setforresinsorted(socket.getaddrinfo(address,port,family,socket.SOCK_STREAM,0,flags),key=lambdax:x[0],        ):ifresinunique_addresses:continueunique_addresses.add(res)af,socktype,proto,canonname,sockaddr=resif (sys.platform=="darwin"andaddress=="localhost"andaf==socket.AF_INET6andsockaddr[3]!=0# type: ignore            ):# Mac OS X includes a link-local address fe80::1%lo0 in the# getaddrinfo results for 'localhost'.  However, the firewall# doesn't understand that this is a local address and will# prompt for access (often repeatedly, due to an apparent# bug in its ability to remember granting access to an# application). Skip these addresses.continuetry:sock=socket.socket(af,socktype,proto)exceptsocket.errorase:iferrno_from_exception(e)==errno.EAFNOSUPPORT:continueraiseifos.name!="nt":try:sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)exceptsocket.errorase:iferrno_from_exception(e)!=errno.ENOPROTOOPT:# Hurd doesn't support SO_REUSEADDR.raiseifreuse_port:sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEPORT,1)ifaf==socket.AF_INET6:# On linux, ipv6 sockets accept ipv4 too by default,# but this makes it impossible to bind to both# 0.0.0.0 in ipv4 and :: in ipv6.  On other systems,# separate sockets *must* be used to listen for both ipv4# and ipv6.  For consistency, always disable ipv4 on our# ipv6 sockets and use a separate ipv4 socket when needed.## Python 2.x on windows doesn't have IPPROTO_IPV6.ifhasattr(socket,"IPPROTO_IPV6"):sock.setsockopt(socket.IPPROTO_IPV6,socket.IPV6_V6ONLY,1)# automatic port allocation with port=None# should bind on the same port on IPv4 and IPv6host,requested_port=sockaddr[:2]ifrequested_port==0andbound_portisnotNone:sockaddr=tuple([host,bound_port]+list(sockaddr[2:]))sock.setblocking(False)try:>sock.bind(sockaddr)EPermissionError: [WinError10013]AnattemptwasmadetoaccessasocketinawayforbiddenbyitsaccesspermissionsC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\tornado\netutil.py:162:PermissionError
tests.ext.test_conversationhandler.TestConversationHandler::test_no_running_job_queue_warning[False]
Stack Traces | 5.99s run time
@contextlib.contextmanagerdefmap_httpcore_exceptions()->typing.Iterator[None]:globalHTTPCORE_EXC_MAPiflen(HTTPCORE_EXC_MAP)==0:HTTPCORE_EXC_MAP=_load_httpcore_exceptions()try:>yieldC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_transports\default.py:101:__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_transports\default.py:394:inhandle_async_requestresp=awaitself._pool.handle_async_request(req)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_async\connection_pool.py:256:inhandle_async_requestraiseexcfromNoneC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_async\connection_pool.py:236:inhandle_async_requestresponse=awaitconnection.handle_async_request(C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_async\connection.py:101:inhandle_async_requestraiseexcC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_async\connection.py:78:inhandle_async_requeststream=awaitself._connect(request)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_async\connection.py:124:in_connectstream=awaitself._network_backend.connect_tcp(**kwargs)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_backends\auto.py:31:inconnect_tcpreturnawaitself._backend.connect_tcp(C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_backends\anyio.py:113:inconnect_tcpwithmap_exceptions(exc_map):C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\contextlib.py:158:in__exit__self.gen.throw(typ,value,traceback)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _map= {<class'TimeoutError'>:<class'httpcore.ConnectTimeout'>,<class'OSError'>:<class'httpcore.ConnectError'>,<class'anyio.BrokenResourceError'>:<class'httpcore.ConnectError'>}    @contextlib.contextmanagerdefmap_exceptions(map:ExceptionMapping)->typing.Iterator[None]:try:yieldexceptExceptionasexc:# noqa: PIE786forfrom_exc,to_excinmap.items():ifisinstance(exc,from_exc):>raiseto_exc(exc)fromexcEhttpcore.ConnectTimeoutC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpcore\_exceptions.py:14:ConnectTimeoutTheaboveexceptionwasthedirectcauseofthefollowingexception:self=<telegram.request._httpxrequest.HTTPXRequestobjectat0x000002D56FC49C70>url='https://api.telegram.org/bot690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To/getMe'method='POST'request_data=<telegram.request._requestdata.RequestDataobjectat0x000002D56FAF8580>read_timeout=5.0,write_timeout=5.0,connect_timeout=5.0pool_timeout=1.0asyncdefdo_request(self,url:str,method:str,request_data:Optional[RequestData]=None,read_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,write_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,connect_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,pool_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,    )->tuple[int,bytes]:"""See :meth:`BaseRequest.do_request`."""ifself._client.is_closed:raiseRuntimeError("This HTTPXRequest is not initialized!")files=request_data.multipart_dataifrequest_dataelseNonedata=request_data.json_parametersifrequest_dataelseNone# If user did not specify timeouts (for e.g. in a bot method), use the default ones when we# created this instance.ifisinstance(read_timeout,DefaultValue):read_timeout=self._client.timeout.readifisinstance(connect_timeout,DefaultValue):connect_timeout=self._client.timeout.connectifisinstance(pool_timeout,DefaultValue):pool_timeout=self._client.timeout.poolifisinstance(write_timeout,DefaultValue):write_timeout=self._client.timeout.writeifnotfileselseself._media_write_timeouttimeout=httpx.Timeout(connect=connect_timeout,read=read_timeout,write=write_timeout,pool=pool_timeout,        )try:>res=awaitself._client.request(method=method,url=url,headers={"User-Agent":self.USER_AGENT},timeout=timeout,files=files,data=data,            )telegram\request\_httpxrequest.py:293: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_client.py:1542:inrequestreturnawaitself.send(request,auth=auth,follow_redirects=follow_redirects)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_client.py:1631:insendresponse=awaitself._send_handling_auth(C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_client.py:1659:in_send_handling_authresponse=awaitself._send_handling_redirects(C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_client.py:1696:in_send_handling_redirectsresponse=awaitself._send_single_request(request)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_client.py:1732:in_send_single_requestresponse=awaittransport.handle_async_request(request)C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_transports\default.py:393:inhandle_async_requestwithmap_httpcore_exceptions():C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\contextlib.py:158:in__exit__self.gen.throw(typ,value,traceback)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _    @contextlib.contextmanagerdefmap_httpcore_exceptions()->typing.Iterator[None]:globalHTTPCORE_EXC_MAPiflen(HTTPCORE_EXC_MAP)==0:HTTPCORE_EXC_MAP=_load_httpcore_exceptions()try:yieldexceptExceptionasexc:mapped_exc=Noneforfrom_exc,to_excinHTTPCORE_EXC_MAP.items():ifnotisinstance(exc,from_exc):continue# We want to map to the most specific exception we can find.# Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to# `httpx.ReadTimeout`, not just `httpx.TimeoutException`.ifmapped_excisNoneorissubclass(to_exc,mapped_exc):mapped_exc=to_excifmapped_excisNone:# pragma: no coverraisemessage=str(exc)>raisemapped_exc(message)fromexcEhttpx.ConnectTimeoutC:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\httpx\_transports\default.py:118:ConnectTimeoutTheaboveexceptionwasthedirectcauseofthefollowingexception:self=<tests.ext.test_conversationhandler.TestConversationHandlerobjectat0x000002D56D837110>app=Application[bot=ExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]]bot=PytestExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]user1=User(first_name='Misses Test',id=123,is_bot=False)recwarn=WarningsRecorder(record=True),jq=False    @pytest.mark.parametrize("jq", [True,False])asyncdeftest_no_running_job_queue_warning(self,app,bot,user1,recwarn,jq):handler=ConversationHandler(entry_points=self.entry_points,states=self.states,fallbacks=self.fallbacks,conversation_timeout=0.5,        )ifnotjq:app=ApplicationBuilder().token(bot.token).job_queue(None).build()app.add_handler(handler)message=Message(0,None,self.group,from_user=user1,text="/start",entities=[MessageEntity(type=MessageEntity.BOT_COMMAND,offset=0,length=len("/start"))            ],        )message.set_bot(bot)message._unfreeze()message.entities[0]._unfreeze()>asyncwithapp:tests\ext\test_conversationhandler.py:1092: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _telegram\ext\_application.py:370:in__aenter__awaitself.initialize()telegram\ext\_application.py:487:ininitializeawaitself.bot.initialize()telegram\ext\_extbot.py:297:ininitializeawaitsuper().initialize()telegram\_bot.py:761:ininitializeawaitself.get_me()telegram\ext\_extbot.py:1924:inget_mereturnawaitsuper().get_me(telegram\_bot.py:893:inget_meresult=awaitself._post(telegram\_bot.py:617:in_postreturnawaitself._do_post(telegram\ext\_extbot.py:351:in_do_postreturnawaitsuper()._do_post(telegram\_bot.py:646:in_do_postresult=awaitrequest.post(telegram\request\_baserequest.py:202:inpostresult=awaitself._request_wrapper(telegram\request\_baserequest.py:334:in_request_wrappercode,payload=awaitself.do_request(__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _self=<telegram.request._httpxrequest.HTTPXRequestobjectat0x000002D56FC49C70>url='https://api.telegram.org/bot690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To/getMe'method='POST'request_data=<telegram.request._requestdata.RequestDataobjectat0x000002D56FAF8580>read_timeout=5.0,write_timeout=5.0,connect_timeout=5.0pool_timeout=1.0asyncdefdo_request(self,url:str,method:str,request_data:Optional[RequestData]=None,read_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,write_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,connect_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,pool_timeout:ODVInput[float]=BaseRequest.DEFAULT_NONE,    )->tuple[int,bytes]:"""See :meth:`BaseRequest.do_request`."""ifself._client.is_closed:raiseRuntimeError("This HTTPXRequest is not initialized!")files=request_data.multipart_dataifrequest_dataelseNonedata=request_data.json_parametersifrequest_dataelseNone# If user did not specify timeouts (for e.g. in a bot method), use the default ones when we# created this instance.ifisinstance(read_timeout,DefaultValue):read_timeout=self._client.timeout.readifisinstance(connect_timeout,DefaultValue):connect_timeout=self._client.timeout.connectifisinstance(pool_timeout,DefaultValue):pool_timeout=self._client.timeout.poolifisinstance(write_timeout,DefaultValue):write_timeout=self._client.timeout.writeifnotfileselseself._media_write_timeouttimeout=httpx.Timeout(connect=connect_timeout,read=read_timeout,write=write_timeout,pool=pool_timeout,        )try:res=awaitself._client.request(method=method,url=url,headers={"User-Agent":self.USER_AGENT},timeout=timeout,files=files,data=data,            )excepthttpx.TimeoutExceptionaserr:ifisinstance(err,httpx.PoolTimeout):raiseTimedOut(message=("Pool timeout: All connections in the connection pool are occupied. ""Request was *not* sent to Telegram. Consider adjusting the connection ""pool size or the pool timeout."                    )                )fromerr>raiseTimedOutfromerrEtelegram.error.TimedOut:Timedouttelegram\request\_httpxrequest.py:310:TimedOut

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

@Bibo-JoshiBibo-Joshi merged commit59aabc7 intoapi-8.0Nov 28, 2024
19 of 21 checks passed
@Bibo-JoshiBibo-Joshi deleted the api-8.0-set-user-emoji-status branchNovember 28, 2024 18:45
@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. What a method...

@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