
    {iA                    j    S r SSKJr  SSKJrJrJrJr  SSKJ	r	J
r
  SSKJr  SSKJr   " S	 S
\5      rg)zProvide the Auth class.    )annotations)
AuthorizerImplicitAuthorizerUntrustedAuthenticatorsession   )InvalidImplicitAuth!MissingRequiredAttributeException)_deprecate_args   )PRAWBasec                      \ rS rSrSr\SS j5       rSS jr\" SSS5      SS j5       r	SS	 jr
\" S
SSS5      SSS.         SS jj5       rSrg)Auth   z5Auth provides an interface to Reddit's authorization.c                    U R                   R                  R                  nUR                  UR                  UR
                  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     J/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/auth.pylimitsAuth.limits   s:    * ||!!//#33II
 	
    c                8   U R                   R                  R                  R                  n[	        U5      nUR                  U5        [        X0R                   R                  R                  S9nU=U R                   l	        U R                   l
        UR                  $ )a  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.


authorizerwindow_size)r   _read_only_core_authorizer_authenticatorr   	authorizer   configr!   r   _authorized_corerefresh_token)r   codeauthenticatorr    authorized_sessions        r   r%   Auth.authorize+   s|     44@@OO.
T"$!||/B/B/N/N
 >POT\\:'''r   access_token
expires_inscopec               6   U R                   R                  R                  R                  n[	        U[
        5      (       d  [        e[        [        XAX#5      U R                   R                  R                  S9nU=U R                   l        U R                   l        g)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.

r   N)r   r"   r#   r$   
isinstancer   r	   r   r   r&   r!   r   r'   )r   r-   r.   r/   r*   implicit_sessions         r   implicitAuth.implicit>   s{    " 44@@OO-)?@@%%")Z ++77	
 >NMT\\:r   c                    U R                   R                  R                  nUR                  5       (       d  UR	                  5         UR
                  $ )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   r8   Auth.scopesZ   s@     \\''33
""$$    r   r8   statedurationr3   	permanentF)r;   r3   c               h   U R                   R                  R                  R                  nUR                  U R                   R
                  R                  L a  Sn[        U5      e[        U[        5      (       a  UR                  U(       a  SOUUUUS9$ U(       a  [        eUR                  XU5      $ )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)r3   )r   r"   r#   r$   redirect_urir&   CONFIG_NOT_SETr
   r1   r   authorize_urlr	   )r   r;   r3   r8   r:   r*   msgs          r   urlAuth.urle   s    4 44@@OO%%)<)<)K)KK1C3C88m%;<< ..'X!	 /   %%**8UCCr    N)returnzdict[str, str | int | None])r)   strrF   z
str | None)r-   rG   r.   intr/   rG   )rF   zset[str])
r;   rG   r3   boolr8   z	list[str]r:   rG   rF   rG   )__name__
__module____qualname____firstlineno____doc__propertyr   r%   r   r3   r8   rC   __static_attributes__rE   r   r   r   r      s    ?
 
6(& ^\7;N <N6	! Xw
J? $	&D &D 	&D
 &D &D 
&D @&Dr   r   N)rN   
__future__r   prawcorer   r   r   r   
exceptionsr	   r
   utilr   baser   r   rE   r   r   <module>rV      s*     " T T O " @D8 @Dr   