run()¶
- Client.run(coroutine=None, *, use_qr: bool = False, except_ids: List[int] = [])¶
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()andstop()in sequence. It makes running a single client less verbose.If you want to run multiple clients at once, see
ftmgram.compose().- Parameters:
coroutine (
Coroutine, optional) – Pass a coroutine to run it until it completes, without starting/stopping the client.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 ftmgram import Client app = Client("my_account") ... # Set handlers up app.run()