start()¶
- Client.start()¶
Start the client.
This method connects the client to Telegram and, in case of new sessions, automatically manages the authorization process using an interactive prompt.
Note
You should install
qrcodepackage if you want to use QR code authorization.- 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.
- Returns:
Client– The started client itself.- Raises:
ConnectionError – In case you try to start an already started client.
Example
import asyncio from pyrogram import Client async def main(): app = Client("my_account") await app.start() ... # Invoke API methods await app.stop() asyncio.run(main())