Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. def run_buyer():
  2.     loop = asyncio.new_event_loop()
  3.  
  4.     # get SMS code ( my func )
  5.     def receive_sms():
  6.         global was_receive
  7.         time.sleep(30) # this code will not implemented
  8.         code = sms.get_status(number_id)
  9.         if 'STATUS_OK' in code:
  10.             was_receive = True
  11.             return code[10:]
  12.  
  13.     name = names.get_full_name().split()
  14.     try:
  15.         # login
  16.         client = TelegramClient('sessions/' + str(number), app.api_id, app.api_hash,
  17.                                 proxy=get_proxy()).start(
  18.             phone=number, force_sms=True, code_callback=receive_sms, first_name=name[0], last_name=name[1])
  19.         print(client)
  20.    
  21.     except RuntimeError:
  22.         ...
  23.    
  24.  
  25. for _ in range(0, self.count):
  26.     Thread(target=run_buyer).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement