Guest User

Untitled

a guest
Jul 6th, 2019
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. INFO:telethon.network.connection.connection: The server closed the connection while sending
  2.  
  3. ERROR:telethon.network.connection.connection: Unhandled exception from send_task
  4.  
  5. chunks of my code:
  6.  
  7. import logging
  8.  
  9. logging.basicConfig(level=logging.INFO)
  10.  
  11.  
  12.  
  13. api_id = 123
  14. api_hash = '123'
  15.  
  16. phone = '+123'
  17. client = TelegramClient(phone, api_id, api_hash, auto_reconnect=True, connection_retries=9999)
  18.  
  19. client.connect()
  20. if not client.is_user_authorized():
  21.     client.send_code_request(phone)
  22.     client.sign_in(phone, input('Enter the code: '))
  23.  
  24. except PeerFloodError:
  25.         print("Getting Flood Error from telegram. Script is stopping now. Please try again after some time.")
  26.         time.sleep(3800)
  27.     except ConnectionResetError:
  28.         print('ConnectionResetError')
  29.         client.connect()
  30.     except ConnectionRefusedError:
  31.         print('ConnectionRefusedError')
  32.         client.connect()
  33.     except ConnectionAbortedError:
  34.         print('ConnectionAbortedError')
  35.         client.connect()
  36.     except:
  37.         traceback.print_exc()
  38.         print("Unexpected Error")
  39.         continue
  40.  
  41.  
  42. ## ofcurse thats just a chunk from my code and not all of it. the except is in for loop.
Advertisement
Add Comment
Please, Sign In to add comment