Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def code(self):
- wrapper = Sms('')
- activation = GetNumber(service=SmsService().Telegram,
- country=SmsTypes.Country.KZ, ).request(wrapper)
- set_as_sent = SetStatus(
- id=activation.id,
- status=SmsTypes.Status.SmsSent
- ).request(wrapper)
- while True:
- time.sleep(1)
- response = GetStatus(id=activation.id).request(wrapper)
- if response['code']:
- print('Your code:{}'.format(response['code']))
- code_sent = response['code']
- break
- set_as_end = SetStatus(id=activation.id, status=SmsTypes.Status.End).request(wrapper)
- return code_sent
- def reg():
- client = TelegramClient('18', api_id, api_hash)
- client.connect()
- client.start(phone=activation.phone_number, code_callback=code())
- reg()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement