B
    f’»dÕ  ã               @   s&   d dl Z d dlmZ G dd„ dƒZdS )é    N)ÚSessionc               @   s   e Zd Zdedœdd„ZdS )ÚConnectzpyrogram.Client)ÚselfÚreturnc             Ã   sz   | j rtdƒ‚|  ¡ I dH  t| | j ¡ I dH | j ¡ I dH | j ¡ I dH ƒ| _| j 	¡ I dH  d| _ t
| j ¡ I dH ƒS )ah  
        Connect the client to Telegram servers.

        Returns:
            ``bool``: On success, in case the passed-in session is authorized, True is returned. Otherwise, in case
            the session needs to be authorized, False is returned.

        Raises:
            ConnectionError: In case you try to connect an already connected client.
        zClient is already connectedNT)Zis_connectedÚConnectionErrorZload_sessionr   ZstorageZdc_idZauth_keyZ	test_modeÚsessionÚstartÚboolZuser_id)r   © r
   úA/tmp/pip-unpacked-wheel-rcokkf2l/pyrogram/methods/auth/connect.pyÚconnect   s    "zConnect.connectN)Ú__name__Ú
__module__Ú__qualname__r	   r   r
   r
   r
   r   r      s   r   )ZpyrogramZpyrogram.sessionr   r   r
   r
   r
   r   Ú<module>   s   