Probably a silly question. Certainly it's a problem with my code, but actually I got stuck and even not understand where to search.
I want to get the messages and the photos from a channel using telethon. No problem with messages I got them. Now, I try to get the photos (if there is any in the message).
All messages stored in a list called messages.
Here is my code to download photos :
for i, cur_mes in enumerate(messages) :
print(i)
print(cur_mes.date)
print(cur_mes.message)
if cur_mes.photo :
print(cur_mes.photo)
with client :
try :
client.download_media(cur_mes.photo,"./img/"+str(cur_mes.date)+".jpg")
except FloodWaitError as ee:
e = str(ee)
time.sleep(int(re.search(r'\d+', e).group()))
client.download_media(cur_mes.photo,"./img/"+str(cur_mes.date)+".jpg")
This code download the first photo. And then it stops with error :
telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: FILEREF_UPGRADE_NEEDED (caused by GetFileRequest)
I don't understand "AuthKeyError: RPCError 406: FILEREF_UPGRADE_NEEDED". If I try to catch it (cause it's indicated that RPCErrors could be even on the server side), the code will continue to work, but all the photos (except first) are empties.
UPDATE: As @Lonami supposed in the comments, it was a problem of version. I was so sure to ave the laest that I did not think to check it.
pip3 install telethon --upgrade
solved the problem.
As @Lonami supposed in the comments, it was a problem of version. I was so sure to ave the latest that I did not think to check it.
pip3 install telethon --upgrade
solved the problem.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments