Untitled
unknown
python
3 years ago
1.2 kB
10
Indexable
async def RegisterAccountForNumber(proxy, numberData, firstName, lastName, sessionsName):
numberID = numberData.split(":")[0]
number = numberData.split(":")[1]
print(numberData, numberID, number)
matches = re.search(r"(?P<proto>\w+):\/\/(?:(?P<login>[^:]+):(?P<pass>[^@]+)@?)?(?P<ip>[0-9.]+):(?P<port>[0-9]+)", proxy)
proxy = {
'proxy_type': python_socks.ProxyType.HTTP,
'addr': matches.group("ip"),
'port': int(matches.group("port")),
'username': matches.group("login") if matches.group("login") != None else None,
'password': matches.group("pass") if matches.group("pass") != None else None,
'rdns': True
}
print(proxy)
api = API.TelegramAndroid.Generate(unique_id=sessionsName+".session")
client = TelegramClient(sessionsName+".session", api=api, proxy=proxy)
print("Отправка кода...")
codeGetterWrapper = SMSHubApi.SMSHubCodeGetter(SMSHub, numberID)
await client.start(phone=number, force_sms=True, first_name=firstName, last_name=lastName, max_attempts=100, code_callback=codeGetterWrapper.GetCode)
print("Регистрация пройдена")
await ConvertSession(client, sessionsName)Editor is loading...