Ë
    …jÐjž  ã                   óz   — d Z ddlmZmZmZmZmZ ddlmZm	Z	m
Z
mZ ddlmZmZ ddlmZ ddlmZ  G d	„ d
e«      Zy)zProvide the Auth class.é    )ÚDictÚListÚOptionalÚSetÚUnion)Ú
AuthorizerÚImplicitAuthorizerÚUntrustedAuthenticatorÚsessioné   )ÚInvalidImplicitAuthÚ!MissingRequiredAttributeException)Ú_deprecate_argsé   )ÚPRAWBasec                   óà   — e Zd ZdZedeeeeee	f      f   fd„«       Z
dedee   fd„Z eddd«      dede	dedd	fd
„«       Zdee   fd„Z edddd«      dddœdededee   dedef
d„«       Zy	)ÚAuthz5Auth provides an interface to Reddit's authorization.Úreturnc                 óŠ   — | j                   j                  j                  }|j                  |j                  |j
                  dœS )a  Return a dictionary containing the rate limit info.

        The keys are:

        :remaining: The number of requests remaining to be made in the current rate
            limit window.
        :reset_timestamp: A unix timestamp providing an upper bound on when the rate
            limit counters will reset.
        :used: The number of requests made in the current rate limit window.

        All values are initially ``None`` as these values are set in response to issued
        requests.

        The ``reset_timestamp`` value is an upper bound as the real timestamp is
        computed on Reddit's end in preparation for sending the response. This value may
        change slightly within a given window due to slight changes in response times
        and rounding.

        )Ú	remainingÚreset_timestampÚused)Ú_redditÚ_coreÚ_rate_limiterr   r   r   )ÚselfÚdatas     úŠ/var/labsstorage/home/Thilakkumar/htdocs/soical-media-automation/automation_platform/venv/lib/python3.12/site-packages/praw/models/auth.pyÚlimitszAuth.limits   s:   € ð* �|‰|×!Ñ!×/Ñ/ˆàŸ™Ø#×3Ñ3Ø—I‘Iñ
ð 	
ó    Úcodec                 ó   — | j                   j                  j                  j                  }t	        |«      }|j                  |«       t        |«      }|x| j                   _        | j                   _        |j                  S )a7  Complete the web authorization flow and return the refresh token.

        :param code: The code obtained through the request to the redirect uri.

        :returns: The obtained refresh token, if available, otherwise ``None``.

        The session's active authorization will be updated upon success.

        )
r   Ú_read_only_coreÚ_authorizerÚ_authenticatorr   Ú	authorizer   r   Ú_authorized_coreÚrefresh_token)r   r!   ÚauthenticatorÚ
authorizerÚauthorized_sessions        r   r&   zAuth.authorize*   sf   € ð Ÿ™×4Ñ4×@Ñ@×OÑOˆÜ Ó.ˆ
Ø×Ñ˜TÔ"Ü$ ZÓ0ÐØ=OÐOˆ�‰Ô˜TŸ\™\Ô:Ø×'Ñ'Ð'r    Úaccess_tokenÚ
expires_inÚscopeNc                óö   — | j                   j                  j                  j                  }t	        |t
        «      st        ‚t        t        ||||«      «      }|x| j                   _	        | j                   _
        y)a  Set the active authorization to be an implicit authorization.

        :param access_token: The access_token obtained from Reddit's callback.
        :param expires_in: The number of seconds the ``access_token`` is valid for. The
            origin of this value was returned from Reddit's callback. You may need to
            subtract an offset before passing in this number to account for a delay
            between when Reddit prepared the response, and when you make this function
            call.
        :param scope: A space-delimited string of Reddit OAuth2 scope names as returned
            from Reddit's callback.

        :raises: :class:`.InvalidImplicitAuth` if :class:`.Reddit` was initialized for a
            non-installed application type.

        N)r   r#   r$   r%   Ú
isinstancer
   r   r   r	   r   r'   )r   r,   r-   r.   r)   Úimplicit_sessions         r   ÚimplicitzAuth.implicit;   sd   € ð" Ÿ™×4Ñ4×@Ñ@×OÑOˆÜ˜-Ô)?Ô@Ü%Ð%Ü"Ü˜}¨l¸JÈÓNó
Ðð >NÐMˆ�‰Ô˜TŸ\™\Õ:r    c                 óš   — | j                   j                  j                  }|j                  «       s|j	                  «        |j
                  S )z‹Return a set of scopes included in the current authorization.

        For read-only authorizations this should return ``{"*"}``.

        )r   r   r$   Úis_validÚrefreshÚscopes)r   r*   s     r   r6   zAuth.scopesT   s=   € ð —\‘\×'Ñ'×3Ñ3ˆ
Ø×"Ñ"Ô$Ø×ÑÔ Ø× Ñ Ð r    r6   ÚstateÚdurationr2   Ú	permanentF)r8   r2   c                óL  — | j                   j                  j                  j                  }|j                  | j                   j
                  j                  u rt        d«      ‚t        |t        «      r|j                  |rdn||||¬«      S |rt        ‚|j                  |||«      S )a)  Return the URL used out-of-band to grant access to your application.

        :param duration: Either ``"permanent"`` or ``"temporary"`` (default:
            ``"permanent"``). ``"temporary"`` authorizations generate access tokens that
            last only 1 hour. ``"permanent"`` authorizations additionally generate a
            refresh token that expires 1 year after the last use and can be used
            indefinitely to generate new hour-long access tokens. This value is ignored
            when ``implicit=True``.
        :param implicit: For **installed** applications, this value can be set to use
            the implicit, rather than the code flow. When ``True``, the ``duration``
            argument has no effect as only temporary tokens can be retrieved.
        :param scopes: A list of OAuth scopes to request authorization for.
        :param state: A string that will be reflected in the callback to
            ``redirect_uri``. This value should be temporarily unique to the client for
            whom the URL was generated for.

        zredirect_uri must be providedÚ	temporary)r2   )r   r#   r$   r%   Úredirect_uriÚconfigÚCONFIG_NOT_SETr   r0   r
   Úauthorize_urlr   )r   r8   r2   r6   r7   r)   s         r   ÚurlzAuth.url_   sœ   € ð4 Ÿ™×4Ñ4×@Ñ@×OÑOˆØ×%Ñ%¨¯©×)<Ñ)<×)KÑ)KÑKÜ3Ð4SÓTÐTÜ�mÔ%;Ô<Ø ×.Ñ.Ù'‘¨XØØØ!ð	 /ó ð ñ Ü%Ð%Ø×*Ñ*¨8°V¸UÓCÐCr    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   Ústrr   r   Úintr   r&   r   r2   r   r6   Úboolr   r@   © r    r   r   r      s   „ Ù?àð
˜˜S (¨5°°c°©?Ñ";Ð;Ñ<ò 
ó ð
ð6(˜cð ( h¨s¡mó (ñ" �^ \°7Ó;ðN¨ð N¸ð NÀSð NÈTò Nó <ðNð0	!˜˜C™ó 	!ñ �X˜w¨
°JÓ?ð $Øò	%Dð ð%Dð ð	%Dð
 �S‘	ð%Dð ð%Dð 
ò%Dó @ñ%Dr    r   N)rD   Útypingr   r   r   r   r   Úprawcorer   r	   r
   r   Ú
exceptionsr   r   Úutilr   Úbaser   r   rI   r    r   ú<module>rO      s-   ðÙ ß 3Õ 3ç TÓ Tç OÝ "Ý ôzDˆ8õ zDr    