[x] The error is in the library's code, and not in my own.
[x] I have searched for this issue before posting it and there isn't a duplicate.
[x] I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.
Code that causes the issue
from telethon.sync import TelegramClient
async def fetch_contacts(self):
async with TelegramClient(self.session, self.api_id, self.api_hash) as client:
# Fetch all the contacts
contacts = await client(GetContactsRequest(hash=0))
# Store the contacts in a data frame
df = pd.DataFrame([{'Username': c.username or '', 'Name': c.first_name + ' ' +
c.last_name if c.last_name else c.first_name, 'Phone': c.phone, 'UserID': int(c.id)} for c in contacts.users])
return df
What I've tried so far:
I've searched for this issue and yes there are duplicates but none of the suggestions worked.
I tried using Proxy but still the problem remains the same
It works on Google Colab for some reason but not at local system
Disabled Firewall and Antivirus but still the same error
Used various suggestion by ChatGPT but none works
Messed around with asyncio but no luck
Traceback
Traceback (most recent call last):
Security error while unpacking a received message: Server replied with a wrong session ID
Security error while unpacking a received message: Server replied with a wrong session ID
Traceback (most recent call last):
File "c:\Users\HAIER\Desktop\Contact List Scraper\Python_Files\Telegram_Contacts.py", line 300, in on_contacts_radio_checked
asyncio.run(self.run_main())
File "C:\Users\HAIER\miniconda3\envs\experiments\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\HAIER\miniconda3\envs\experiments\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "c:\Users\HAIER\Desktop\Contact List Scraper\Python_Files\Telegram_Contacts.py", line 304, in run_main
await self.main_function()
File "c:\Users\HAIER\Desktop\Contact List Scraper\Python_Files\Telegram_Contacts.py", line 312, in main_function
main_contacts = await self.fetch_contacts()
File "c:\Users\HAIER\Desktop\Contact List Scraper\Python_Files\Telegram_Contacts.py", line 292, in fetch_contacts
contacts = await client(GetContactsRequest(hash=0))
File "C:\Users\HAIER\miniconda3\envs\experiments\lib\site-packages\telethon\client\users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "C:\Users\HAIER\miniconda3\envs\experiments\lib\site-packages\telethon\client\users.py", line 130, in _call
raise ValueError('Request was unsuccessful {} time(s)'
ValueError: Request was unsuccessful 6 time(s)
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.Code that causes the issue
What I've tried so far:
Traceback