run()

Client.run()

Start the client, idle the main script and finally stop the client.

When calling this method without any argument it acts as a convenience method that calls start(), idle() and stop() in sequence. It makes running a single client less verbose.

If you want to run multiple clients at once, see pyrogram.compose().

Parameters:
  • use_qr (bool, optional) – Use QR code authorization instead of the interactive prompt. For new authorizations only. Defaults to False.

  • except_ids (List of int, optional) – List of already logged-in user IDs, to prevent logging in twice with the same user.

Raises:

ConnectionError – In case you try to run an already started client.

Example

from pyrogram import Client

app = Client("my_account")
...  # Set handlers up
app.run()