You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncdefis_account_session_valid(self) ->TelegramClient|None:
"""Checks the validity of a session, including proxy and connection to Telegram servers."""proxy=Noneifself.proxy:
proxy= (
self.proxy.proxy_type, self.proxy.ip, self.proxy.port, True, self.proxy.username, self.proxy.password)
ifnotself.proxy.check_proxy():
print(f"Error. Proxy is not working")
returnNonetry:
client=TelegramClient(StringSession(self.session_string), self.api_id, self.api_hash, proxy=proxy,
device_model=self.device_model, system_version=self.system_version,
app_version=self.app_version, lang_code=self.lang_code,
system_lang_code=self.system_lang_code)
awaitclient.connect()
ifnotawaitclient.is_user_authorized():
print(f"Session is not authorized for account {self.telegram_id}")
awaitclient.disconnect()
returnNoneprint(f"Session is valid for account {self.telegram_id}")
returnclient# Return connected TelegramClientexcept (SessionPasswordNeededError, Exception) ase:
print(f"Error checking session for account {self.telegram_id}: {e}")
returnNone### Expected behaviorNoban### Actual behaviorIhaveapre-registeredaccountthroughthemobileapp. IsuccessfullylogintoitusingTelethon, withmyphoneandtwo-factorauthentication. However, afterrunningthecodeseveraltimeswiththisactivesession (StringSession), myaccountgetsbannedanddeleted.
### Traceback
Proxy successfully checked via http://httpbin.org/ip. Ping: 574.9 ms
Session is not authorized for account 7184956349
Authorizing for account 7184956349
Authentication error: The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam (caused by SendCodeRequest)
Telethon version
1.36.0
Python version
3.9.13
Operating system (including distribution name and version)
Win 10
Other details
No response
Checklist
The error is in the library's code, and not in my own.
I have searched for this issue before posting it and there isn't an open duplicate.
I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
The text was updated successfully, but these errors were encountered:
Code that causes the issue
Proxy successfully checked via http://httpbin.org/ip. Ping: 574.9 ms
Session is not authorized for account 7184956349
Authorizing for account 7184956349
Authentication error: The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam (caused by SendCodeRequest)
Telethon version
1.36.0
Python version
3.9.13
Operating system (including distribution name and version)
Win 10
Other details
No response
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.The text was updated successfully, but these errors were encountered: