Write a script that adds contacts to the cart, the code works with one account but I don't want another thing to do?

Write a script that adds contacts to the cart, the code works with one account but I don't want on the other; the code is simple as hell, but to understand what's not can't.
from telethon TelegramClient import, sync
from telethon.tl.functions.contacts import ImportContactsRequest
from telethon.tl.types import InputPhoneContact
from time import sleep

api_id = xxx
api_hash = 'xxx'
phone = "xxx"

client = TelegramClient('Pars-session', api_id, api_hash)
client.start()
client.sign_in(phone)

phone_numbers = open('phone-numbers.txt', 'r')
phones = open('tg-phones.txt', 'a', encoding='utf8')
x = int(1)
for phone_number in phone_numbers:
 contact = InputPhoneContact(client_id=0, phone=phone_number, first_name=phone_number, last_name=phone_number)
 result = client(ImportContactsRequest([contact]))
print(result.stringify())
 if result.popular_invites:
 phones.write("the Number is not added:" + phone_number)
 print(x, ") a Room not added: ", phone_number)
 x += 1
sleep(7)
else:
 phones.write("Room added:" + phone_number)
 print(x, ") Number attached: ", phone_number)
 x += 1
 sleep(7)

The only thing that is strange to me is that early result gave all the data about the user, and is not, what can I do?
April 4th 20 at 13:13
0 answer

Find more questions by tags PythonTelegram