Ë
    Eü´j–J  ã                  ód  — d Z ddlmZ ddlZddlmZmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZmZ erdd
lmZ ddlmZ ddlmZ  G d„ de«      Z G d„ d«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z  G d„ de«      Z! G d„ de«      Z" G d„ de«      Z#y)z2Provides Authentication and Authorization classes.é    )ÚannotationsN)ÚABCÚabstractmethod)ÚTYPE_CHECKINGÚAnyÚcast)ÚRequest)Úcodes)Úconst)ÚInvalidInvocationÚOAuthExceptionÚResponseException)ÚCallable)ÚResponse)Ú	Requestorc                  ót   — e Zd ZdZedd„«       Zedd„«       Zddœ	 	 	 	 	 	 	 dd„Zdd„Z	dd	œdd
„Z
ddœdd„Zy)ÚBaseAuthenticatorzEProvide the base authenticator object that stores OAuth2 credentials.c                 ó   — y ©N© ©Úselfs    úK/root/workspace/ytshorts/venv/lib/python3.12/site-packages/prawcore/auth.pyÚ_authzBaseAuthenticator._auth   s   € àó    c                ó   — | j                   S )z;Return the :class:`.Requestor` used to issue HTTP requests.)Ú
_requestorr   s    r   Ú	requestorzBaseAuthenticator.requestor   s   € ð �‰Ðr   N©Úredirect_uric               ó.   — || _         || _        || _        y)a%  Represent a single authentication to Reddit's API.

        :param client_id: The OAuth2 client ID to use with the session.
        :param redirect_uri: The redirect URI exactly as specified in your OAuth
            application settings on Reddit. This parameter is required if you want to
            use the :meth:`~.Authorizer.authorize_url` method, or the
            :meth:`~.Authorizer.authorize` method of the :class:`.Authorizer` class
            (default: ``None``).
        :param requestor: An instance of :class:`.Requestor`.

        N)r   Ú	client_idr    )r   r"   r    r   s       r   Ú__init__zBaseAuthenticator.__init__#   s   € ð$ $ˆŒØ"ˆŒØ(ˆÕr   c          	     óÖ   — | j                   j                  d|| j                  «       t        |j	                  «       «      ddi¬«      }|j
                  t        d   k7  rt        |«      ‚|S )NÚpostÚ
ConnectionÚclose)ÚauthÚdataÚheadersÚok)r   Úrequestr   ÚsortedÚitemsÚstatus_coder
   r   )r   Úurlr)   Úresponses       r   Ú_postzBaseAuthenticator._post9   sd   € Ø—?‘?×*Ñ*ØØØ—‘“Ü˜Ÿ
™
›Ó%Ø! 7Ð+ð +ó 
ˆð ×Ñ¤5¨¡;Ò.Ü# HÓ-Ð-Øˆr   F)Úimplicitc               ó¬  — | j                   €d}t        |«      ‚|rt        | t        «      sd}t        |«      ‚|r|dk7  rd}t        |«      ‚| j                  || j                   |rdnddj                  |«      |dœ}| j                  j                  t        j                  z   }t        d	||¬
«      }t        d|j                  «       j                  «      S )a}  Return the URL used out-of-band to grant access to your application.

        :param duration: Either ``"permanent"`` or ``"temporary"``. ``"temporary"``
            authorizations generate access tokens that last only 1 hour. ``"permanent"``
            authorizations additionally generate a refresh token that can be
            indefinitely used to generate new hour-long access tokens. Only
            ``"temporary"`` can be specified if ``implicit`` is set to ``True``.
        :param implicit: Use the implicit grant flow (default: ``False``). This flow is
            only available for :class:`.UntrustedAuthenticator` instances.
        :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``. Elements must be printable ASCII characters in the range
            ``0x20`` through ``0x7E`` inclusive. This value should be temporarily unique
            to the client for whom the URL was generated.

        :returns: URL to be used out-of-band for granting access to your application.

        :raises: :class:`.InvalidInvocation` if ``redirect_uri`` is not provided, if
            ``implicit`` is ``True`` and an authenticator other than
            :class:`.UntrustedAuthenticator` is used, or ``implicit`` is ``True`` and
            ``duration`` is ``"permanent"``.

        úredirect URI not providedzFOnly UntrustedAuthenticator instances can use the implicit grant flow.Ú	temporaryz>The implicit grant flow only supports temporary access tokens.ÚtokenÚcodeú )r"   Údurationr    Úresponse_typeÚscopeÚstateÚGET)ÚparamsÚstr)r    r   Ú
isinstanceÚUntrustedAuthenticatorr"   Újoinr   Ú
reddit_urlr   ÚAUTHORIZATION_PATHr	   r   Úpreparer0   )	r   r:   r3   Úscopesr=   Úmsgr?   r0   r,   s	            r   Úauthorize_urlzBaseAuthenticator.authorize_urlE   sÍ   € ð0 ×ÑÐ$Ø-ˆCÜ# CÓ(Ð(ÙœJ tÔ-CÔDØZˆCÜ# CÓ(Ð(Ù˜ KÒ/ØRˆCÜ# CÓ(Ð(ð Ÿ™Ø Ø ×-Ñ-Ù(0™W°fØ—X‘X˜fÓ%Øñ
ˆð �o‰o×(Ñ(¬5×+CÑ+CÑCˆÜ˜% ¨VÔ4ˆÜ�E˜7Ÿ?™?Ó,×0Ñ0Ó1Ð1r   ©Ú
token_typec              ó�   — d|i}|�||d<   | j                   j                  t        j                  z   } | j                  dd|i|¤Ž y)a;  Ask Reddit to revoke the provided token.

        :param token: The access or refresh token to revoke.
        :param token_type: When provided, hint to Reddit what the token type is for a
            possible efficiency gain. The value can be either ``"access_token"`` or
            ``"refresh_token"``.

        r7   NÚtoken_type_hintr0   r   )r   rD   r   ÚREVOKE_TOKEN_PATHr2   )r   r7   rK   r)   r0   s        r   Úrevoke_tokenzBaseAuthenticator.revoke_tokens   sO   € ð ˜ÐˆØÐ!Ø&0ˆDÐ"Ñ#Ø�o‰o×(Ñ(¬5×+BÑ+BÑBˆØˆ�
‰
Ñ#�sÐ#˜dÓ#r   ©Úreturnztuple[str, str])rQ   r   )r"   r@   r    ú
str | Noner   r   rQ   ÚNone)r0   r@   r)   r   rQ   r   )
r:   r@   r3   ÚboolrG   z	list[str]r=   r@   rQ   r@   )r7   r@   rK   rR   rQ   rS   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úpropertyr   r#   r2   rI   rO   r   r   r   r   r      s{   „ ÙOàòó ðð òó ðð $(ñ	)ð ð)ð !ð	)ð
 ð)ð 
ó)ó,
ð @Eõ ,2ð\ GKö $r   r   c                  ó^   — e Zd ZU dZeZded<   edd„«       Zdd„Z	d„ Z
dd„Zd„ Zdd	„Zdd
„Zy)ÚBaseAuthorizerz6Superclass for OAuth2 authorization tokens and scopes.z=type[BaseAuthenticator] | tuple[type[BaseAuthenticator], ...]ÚAUTHENTICATOR_CLASSc                ó   — | j                   S )zEReturn the :class:`.BaseAuthenticator` used to authenticate requests.)Ú_authenticatorr   s    r   ÚauthenticatorzBaseAuthorizer.authenticatorˆ   s   € ð ×"Ñ"Ð"r   c               óR   — || _         | j                  «        | j                  «        y)z†Represent a single authorization to Reddit's API.

        :param authenticator: An instance of :class:`.BaseAuthenticator`.

        N)r^   Ú_clear_access_tokenÚ_validate_authenticator)r   r_   s     r   r#   zBaseAuthorizer.__init__�   s$   € ð ,ˆÔØ× Ñ Ô"Ø×$Ñ$Õ&r   c                ó$   — |  d | _         d | _        y r   )Úaccess_tokenrG   r   s    r   ra   z"BaseAuthorizer._clear_access_token—   s   € ÙØ(,ˆÔØ'+ˆ�r   c                óæ  — | j                   j                  j                  t        j                  z   }t        j                  «       } | j                   j                  d
d|i|¤Ž}|j                  «       }d|v rt        ||d   |j                  d«      «      ‚||d   dz   t        j                  z  z   | _        |d   | _        d|v r
|d   | _        t        |d   j!                  d	«      «      | _        y )Nr0   ÚerrorÚerror_descriptionÚ
expires_iné
   rd   Úrefresh_tokenr<   r9   r   )r^   r   rD   r   ÚACCESS_TOKEN_PATHÚtimeÚmonotonic_nsr2   Újsonr   ÚgetÚNANOSECONDSÚ_expiration_timestamp_nsrd   rj   ÚsetÚsplitrG   )r   r)   r0   Úpre_request_timestamp_nsr1   Úpayloads         r   Ú_request_tokenzBaseAuthorizer._request_tokenœ   sæ   € Ø×!Ñ!×+Ñ+×6Ñ6¼×9PÑ9PÑPˆÜ#'×#4Ñ#4Ó#6Ð à,�4×&Ñ&×,Ñ,Ñ=°Ð=¸Ñ=ˆØ—-‘-“/ˆØ�gÑÜ  ¨7°7Ñ+;¸W¿[¹[ÐI\Ó=]Ó^Ð^à(@ÀGÈLÑDYÐ\^ÑD^Ôbg×bsÑbsÑCsÑ(sˆÔ%Ø# NÑ3ˆÔØ˜gÑ%Ø!(¨Ñ!9ˆDÔÜ˜' 'Ñ*×0Ñ0°Ó5Ó6ˆ�r   c                ó`  — t        | j                  | j                  «      s‰d}t        | j                  t        «      r(|d| j                  j                  › d�z  }t        |«      ‚|ddj                  | j                  D �cg c]  }|j                  ‘Œ c}«      › d�z  }t        |«      ‚y c c}w )Nz!Must use an authenticator of typer9   ú.z or )rA   r^   r\   ÚtyperU   rC   r   )r   rH   Úis      r   rb   z&BaseAuthorizer._validate_authenticator«   s¦   € Ü˜$×-Ñ-¨t×/GÑ/GÔHØ5ˆCÜ˜$×2Ñ2´DÔ9Ø˜˜4×3Ñ3×<Ñ<Ð=¸QÐ?Ñ?�ô $ CÓ(Ð(ð ˜˜6Ÿ;™;¸D×<TÑ<TÖ'U°q¨¯
«
Ò'UÓVÐWÐWXÐYÑY�Ü# CÓ(Ð(ð Iùò
 (Vs   Â B+c                ód   — | j                   duxr! t        j                  «       | j                  k  S )zÍReturn whether the :class:`.Authorizer` is ready to authorize requests.

        A ``True`` return value does not guarantee that the ``access_token`` is actually
        valid on the server side.

        N)rd   rl   rm   rq   r   s    r   Úis_validzBaseAuthorizer.is_valid´   s.   € ð × Ñ ¨Ð,Òd´×1BÑ1BÓ1DÀt×GdÑGdÑ1dÐdr   c                ó¤   — | j                   €d}t        |«      ‚| j                  j                  | j                   d¬«       | j	                  «        y)z!Revoke the current Authorization.Nzno token available to revokerd   rJ   )rd   r   r^   rO   ra   ©r   rH   s     r   ÚrevokezBaseAuthorizer.revoke½   sI   € à×ÑÐ$Ø0ˆCÜ# CÓ(Ð(à×Ñ×(Ñ(¨×):Ñ):À~Ð(ÔVØ× Ñ Õ"r   N)rQ   r   )r_   r   rQ   rS   )r)   r   )rQ   rT   ©rQ   rS   )rU   rV   rW   rX   r   r\   Ú__annotations__rY   r_   r#   ra   rv   rb   r|   r   r   r   r   r[   r[   ƒ   sB   … Ù@àYjÐÐVÓjàò#ó ð#ó'ò,ó
7ò)óeô#r   r[   c                  óT   ‡ — e Zd ZU dZdZded<   ddœ	 	 	 	 	 	 	 	 	 d	ˆ fd„Zd
d„Zˆ xZS )ÚTrustedAuthenticatorzEStore OAuth2 authentication credentials for web, or script type apps.r8   r@   ÚRESPONSE_TYPENr   c               ó8   •— t         ‰| �  |||¬«       || _        y)au  Represent a single authentication to Reddit's API.

        :param client_id: The OAuth2 client ID to use with the session.
        :param client_secret: The OAuth2 client secret to use with the session.
        :param redirect_uri: The redirect URI exactly as specified in your OAuth
            application settings on Reddit. This parameter is required if you want to
            use the :meth:`~.Authorizer.authorize_url` method, or the
            :meth:`~.Authorizer.authorize` method of the :class:`.Authorizer` class
            (default: ``None``).
        :param requestor: An instance of :class:`.Requestor`.

        )r"   r    r   N)Úsuperr#   Úclient_secret)r   r"   r‡   r    r   Ú	__class__s        €r   r#   zTrustedAuthenticator.__init__Ì   s"   ø€ ô( 	‰Ñ 9¸<ÐS\ÐÔ]Ø*ˆÕr   c                ó2   — | j                   | j                  fS r   )r"   r‡   r   s    r   r   zTrustedAuthenticator._authã   s   € Ø�~‰~˜t×1Ñ1Ð1Ð1r   )
r"   r@   r‡   r@   r    rR   r   r   rQ   rS   rP   )	rU   rV   rW   rX   r„   r�   r#   r   Ú__classcell__©rˆ   s   @r   rƒ   rƒ   Ç   sQ   ø… ÙOà€M�3Óð $(ñ+ð ð+ð ð	+ð
 !ð+ð ð+ð 
õ+÷.2r   rƒ   c                  ó   — e Zd ZdZdd„Zy)rB   zCStore OAuth2 authentication credentials for installed applications.c                ó   — | j                   dfS )NÚ )r"   r   s    r   r   zUntrustedAuthenticator._authê   s   € Ø�~‰~˜rÐ!Ð!r   NrP   )rU   rV   rW   rX   r   r   r   r   rB   rB   ç   s
   „ ÙMô"r   rB   c                  ób   ‡ — e Zd ZdZddddœ	 	 	 	 	 	 	 	 	 d
ˆ fd„Zdd„Zdd„Zddœdˆ fd	„Zˆ xZS )Ú
Authorizerz/Manages OAuth2 authorization tokens and scopes.N)Úpost_refresh_callbackÚpre_refresh_callbackrj   c               óP   •— t         ‰| �  |¬«       || _        || _        || _        y)a¾  Represent a single authorization to Reddit's API.

        :param authenticator: An instance of a subclass of :class:`.BaseAuthenticator`.
        :param post_refresh_callback: When a single-argument function is passed, the
            function will be called prior to refreshing the access and refresh tokens.
            The argument to the callback is the :class:`.Authorizer` instance. This
            callback can be used to inspect and modify the attributes of the
            :class:`.Authorizer`.
        :param pre_refresh_callback: When a single-argument function is passed, the
            function will be called after refreshing the access and refresh tokens. The
            argument to the callback is the :class:`.Authorizer` instance. This callback
            can be used to inspect and modify the attributes of the
            :class:`.Authorizer`.
        :param refresh_token: Enables the ability to refresh the authorization.

        ©r_   N)r†   r#   Ú_post_refresh_callbackÚ_pre_refresh_callbackrj   )r   r_   r‘   r’   rj   rˆ   s        €r   r#   zAuthorizer.__init__ñ   s-   ø€ ô0 	‰Ñ }ÐÔ5Ø&;ˆÔ#Ø%9ˆÔ"Ø*ˆÕr   c               óš   — | j                   j                  €d}t        |«      ‚| j                  |d| j                   j                  ¬«       y)z§Obtain and set authorization tokens based on ``code``.

        :param code: The code obtained by an out-of-band authorization request to
            Reddit.

        Nr5   Úauthorization_code)r8   Ú
grant_typer    )r^   r    r   rv   )r   r8   rH   s      r   Ú	authorizezAuthorizer.authorize  sN   € ð ×Ñ×+Ñ+Ð3Ø-ˆCÜ# CÓ(Ð(Ø×ÑØØ+Ø×,Ñ,×9Ñ9ð 	õ 	
r   c                óæ   — | j                   r| j                  | «       | j                  €d}t        |«      ‚| j                  d| j                  ¬«       | j                  r| j	                  | «       yy)z5Obtain a new access token from the ``refresh_token``.Nzrefresh token not providedrj   )r™   rj   )r–   rj   r   rv   r•   r~   s     r   ÚrefreshzAuthorizer.refresh  sj   € à×%Ò%Ø×&Ñ& tÔ,Ø×ÑÐ%Ø.ˆCÜ# CÓ(Ð(Ø×Ñ Àd×FXÑFXÐÔYØ×&Ò&Ø×'Ñ'¨Õ-ð 'r   F)Úonly_accessc               ó¼   •— |s| j                   €t        ‰| �	  «        y| j                  j	                  | j                   d¬«       | j                  «        d| _         y)a  Revoke the current Authorization.

        :param only_access: When explicitly set to ``True``, do not evict the refresh
            token if one is set.

        Revoking a refresh token will in-turn revoke all access tokens associated with
        that authorization.

        Nrj   rJ   )rj   r†   r   r^   rO   ra   )r   r�   rˆ   s     €r   r   zAuthorizer.revoke)  sP   ø€ ñ ˜$×,Ñ,Ð4Ü‰G‰NÕà×Ñ×,Ñ,¨T×-?Ñ-?ÈOÐ,Ô\Ø×$Ñ$Ô&Ø!%ˆDÕr   )
r_   r   r‘   ú#Callable[[Authorizer], None] | Noner’   rŸ   rj   rR   rQ   rS   )r8   r@   rQ   rS   r€   )r�   rT   rQ   rS   )	rU   rV   rW   rX   r#   rš   rœ   r   rŠ   r‹   s   @r   r�   r�   î   se   ø„ Ù9ð FJØDHØ$(ñ+ð )ð+ð  Cð	+ð
 Bð+ð "ð+ð 
õ+ó:
ó 	.ð -2÷ &ó &r   r�   c                  ó<   ‡ — e Zd ZdZeZ	 	 	 	 	 	 	 	 	 	 dˆ fd„Zˆ xZS )ÚImplicitAuthorizerz3Manages implicit installed-app type authorizations.c               óÌ   •— t         ‰| �  |¬«       t        j                  «       |t        j
                  z  z   | _        || _        t        |j                  d«      «      | _
        y)aY  Represent a single implicit authorization to Reddit's API.

        :param access_token: The ``access_token`` obtained from Reddit via callback to
            the authenticator's ``redirect_uri``.
        :param authenticator: An instance of :class:`.UntrustedAuthenticator`.
        :param expires_in: The number of seconds the ``access_token`` is valid for. The
            origin of this value was returned from Reddit via callback to the
            authenticator's redirect uri. Note, 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 in the callback to the authenticator's redirect uri.

        r”   r9   N)r†   r#   rl   rm   r   rp   rq   rd   rr   rs   rG   )r   rd   r_   rh   r<   rˆ   s        €r   r#   zImplicitAuthorizer.__init__@  sS   ø€ ô, 	‰Ñ }ÐÔ5Ü(,×(9Ñ(9Ó(;¸jÌ5×K\ÑK\Ñ>\Ñ(\ˆÔ%Ø(ˆÔÜ˜%Ÿ+™+ cÓ*Ó+ˆ�r   )
rd   r@   r_   rB   rh   Úintr<   r@   rQ   rS   )rU   rV   rW   rX   rB   r\   r#   rŠ   r‹   s   @r   r¡   r¡   ;  sH   ø„ Ù=à0Ðð,ð ð,ð .ð	,ð
 ð,ð ð,ð 
÷,ñ ,r   r¡   c                  ó@   ‡ — e Zd ZdZeZddœ	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚReadOnlyAuthorizerzÔManages authorizations that are not associated with a Reddit account.

    While the ``"*"`` scope will be available, some endpoints simply will not work due
    to the lack of an associated Reddit account.

    N)rG   c               ó4   •— t         ‰| �  |¬«       || _        y)zìRepresent a ReadOnly authorization to Reddit's API.

        :param scopes: A list of OAuth scopes to request authorization for (default:
            ``None``). The scope ``"*"`` is requested when the default argument is used.

        r”   N)r†   r#   Ú_scopes)r   r_   rG   rˆ   s      €r   r#   zReadOnlyAuthorizer.__init__f  s   ø€ ô 	‰Ñ }ÐÔ5Øˆ�r   c                ó„   — i }| j                   rdj                  | j                   «      |d<    | j                  dddi|¤Ž y)z#Obtain a new ReadOnly access token.r9   r<   r™   Úclient_credentialsNr   )r§   rC   rv   )r   Úadditional_kwargss     r   rœ   zReadOnlyAuthorizer.refreshu  sA   € àÐØ�<Š<Ø),¯©°$·,±,Ó)?Ð˜gÑ&Øˆ×ÑÑQÐ';ÐQÐ?PÓQr   )r_   r   rG   úlist[str] | NonerQ   rS   r€   ©	rU   rV   rW   rX   rƒ   r\   r#   rœ   rŠ   r‹   s   @r   r¥   r¥   \  s>   ø„ ñð /Ðð $(ñ	ð )ðð !ð	ð
 
õ÷Rr   r¥   c                  óN   ‡ — e Zd ZdZeZdddœ	 	 	 	 	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZS )ÚScriptAuthorizerzšManages personal-use script type authorizations.

    Only users who are listed as developers for the application will be granted access
    tokens.

    N)rG   Útwo_factor_callbackc               ó^   •— t         ‰| �  |¬«       || _        || _        || _        || _        y)a³  Represent a single personal-use authorization to Reddit's API.

        :param authenticator: An instance of :class:`.TrustedAuthenticator`.
        :param password: The password associated with ``username``.
        :param scopes: A list of OAuth scopes to request authorization for (default:
            ``None``). The scope ``"*"`` is requested when the default argument is used.
        :param two_factor_callback: A function that returns OTPs (One-Time Passcodes),
            also known as 2FA auth codes. If this function is provided, prawcore will
            call it when authenticating.
        :param username: The Reddit username of one of the application's developers.

        r”   N)r†   r#   Ú	_passwordr§   Ú_two_factor_callbackÚ	_username)r   r_   ÚpasswordrG   r¯   Úusernamerˆ   s         €r   r#   zScriptAuthorizer.__init__‡  s2   ø€ ô* 	‰Ñ }ÐÔ5Ø!ˆŒØˆŒØ$7ˆÔ!Ø!ˆ�r   c                óú   — i }| j                   rdj                  | j                   «      |d<   | j                  xr | j                  «       }|r||d<    | j                  dd| j                  | j
                  dœ|¤Ž y)z3Obtain a new personal-use script type access token.r9   r<   Úotpr´   )r™   rµ   r´   Nr   )r§   rC   r²   rv   r³   r±   )r   rª   Útwo_factor_codes      r   rœ   zScriptAuthorizer.refresh¢  s~   € àÐØ�<Š<Ø),¯©°$·,±,Ó)?Ð˜gÑ&Ø×3Ñ3ÒS¸×8QÑ8QÓ8SˆÙØ'6Ð˜eÑ$Øˆ×Ñð 	
Ø!Ø—^‘^Ø—^‘^ñ	
ð  ó		
r   )r_   r   r´   rR   rG   r«   r¯   zCallable[[], str] | Nonerµ   rR   rQ   rS   r€   r¬   r‹   s   @r   r®   r®   }  s^   ø„ ñð /Ðð $(Ø8<ñ"ð )ð"ð ð	"ð
 !ð"ð 6ð"ð ð"ð 
õ"÷6
r   r®   c                  óJ   ‡ — e Zd ZdZeefZdddœ	 	 	 	 	 	 	 dˆ fd„Zdd„Zˆ xZ	S )ÚDeviceIDAuthorizerzÄManages app-only OAuth2 for 'installed' applications.

    While the ``"*"`` scope will be available, some endpoints simply will not work due
    to the lack of an associated Reddit account.

    N)Ú	device_idrG   c               óJ   •— |€d}t         ‰| �  |¬«       || _        || _        y)aÂ  Represent an app-only OAuth2 authorization for 'installed' apps.

        :param authenticator: An instance of :class:`.UntrustedAuthenticator` or
            :class:`.TrustedAuthenticator`.
        :param device_id: A unique ID (20-30 character ASCII string) (default:
            ``None``). ``device_id`` is set to ``"DO_NOT_TRACK_THIS_DEVICE"`` when the
            default argument is used. For more information about this parameter, see:
            https://github.com/reddit/reddit/wiki/OAuth2#application-only-oauth
        :param scopes: A list of OAuth scopes to request authorization for (default:
            ``None``). The scope ``"*"`` is requested when the default argument is used.

        NÚDO_NOT_TRACK_THIS_DEVICEr”   )r†   r#   Ú
_device_idr§   )r   r_   r»   rG   rˆ   s       €r   r#   zDeviceIDAuthorizer.__init__¼  s.   ø€ ð& ÐØ2ˆIÜ‰Ñ }ÐÔ5Ø#ˆŒØˆ�r   c                óž   — i }| j                   rdj                  | j                   «      |d<   d} | j                  d|| j                  dœ|¤Ž y)zObtain a new access token.r9   r<   z0https://oauth.reddit.com/grants/installed_client)r™   r»   Nr   )r§   rC   rv   r¾   )r   rª   r™   s      r   rœ   zDeviceIDAuthorizer.refreshÕ  sU   € àÐØ�<Š<Ø),¯©°$·,±,Ó)?Ð˜gÑ&ØGˆ
Øˆ×Ñð 	
Ø!Ø—o‘oñ	
ð  ó	
r   )r_   r   r»   rR   rG   r«   rQ   rS   r€   )
rU   rV   rW   rX   rƒ   rB   r\   r#   rœ   rŠ   r‹   s   @r   rº   rº   ²  sP   ø„ ñð 0Ð1GÐHÐð !%Ø#'ñð )ðð ð	ð
 !ðð 
õ÷2

r   rº   )$rX   Ú
__future__r   rl   Úabcr   r   Útypingr   r   r   Úrequestsr	   Úrequests.status_codesr
   Úprawcorer   Úprawcore.exceptionsr   r   r   Úcollections.abcr   Úrequests.modelsr   Úprawcore.requestorr   r   r[   rƒ   rB   r�   r¡   r¥   r®   rº   r   r   r   ú<module>rÊ      s­   ðÙ 8å "ã ß #ß +Ñ +å Ý 'å ß TÑ TáÝ(å(å,ôi$˜ô i$÷XA#ñ A#ôH2Ð,ô 2ô@"Ð.ô "ôJ&�ô J&ôZ,˜ô ,ôBR˜ô RôB2
�zô 2
ôj-
˜õ -
r   