Telethon не могу разобраться в чем ошибка и как ее исправить
Telethon не могу разобраться в чем ошибка и как ее исправить:
#!/usr/bin/env python
# -*- coding: utf8 -*-
from telethon import TelegramClient
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.functions.channels import GetFullChannelRequest
from telethon.tl.types import ChannelParticipantsSearch
api_id = 1****19
api_hash = 'c549152************e636d2caf9'
phone_number = '+2505***49'
################################################
channel_username = 'wars****ou1'
################################################
client = TelegramClient('session_name',api_id,api_hash)
#client = invoke()
assert client.connect()
if not client.is_user_authorized():
client.send_code_request(phone_number)
me = client.sign_in(phone_number, input('Enter code: '))
# ---------------------------------------
offset = 0
limit = 200
my_filter = ChannelParticipantsSearch('')
all_participants = []
while_condition = True
# ---------------------------------------
channel = client(GetFullChannelRequest(channel_username))
while while_condition:
participants = client(GetParticipantsRequest(channel=channel_username, filter=my_filter, offset=offset, limit=limit, hash=0))
all_participants.extend(participants.users)
offset += len(participants.users)
if len(participants.users) < limit:
while_condition = False
Warning (from warnings module): File "C:!****m telefony.py", line 25 assert client.connect() RuntimeWarning: coroutine 'TelegramBaseClient.connect' was never awaited
Warning (from warnings module): File "C:m telefony.py", line 26 if not client.is_user_authorized(): RuntimeWarning: coroutine 'UserMethods.is_user_authorized' was never awaited Traceback (most recent call last): File "C:!!!1ny.py", line 40, in all_participants.extend(participants.users) AttributeError: 'coroutine' object has no attribute 'users'