get_session()

async Client.get_session()[source]

Get existing session or create a new one.

Parameters:
  • dc_id (int, optional) – Datacenter identifier.

  • is_media (bool, optional) – Pass True to get or create a media session.

  • is_cdn (bool, optional) – Pass True to get or create a cdn session.

  • business_connection_id (str, optional) – Business connection identifier.

  • export_authorization (bool, optional) – Pass True to export authorization after creating the session. Used only when creating a new session.

  • server_address (str, optional) – Custom server address to connect to. Used only when creating a new session.

  • port (int, optional) – Custom port to connect to. Used only when creating a new session.

  • temporary (bool, optional) – Create temporary session instead of getting from storage. Used only when uploading/downloading and don’t forget to stop it.

  • adopt_as_main (bool, optional) – Pass True to make the new session the client’s main one before it connects, so a datacenter migration announces the new connection.