Ë
    +Ñ¦h_  ã            
       ó„   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	 G d„ de«      Z
	 	 dd	d	d	d	d	e
d	d	d
œd„Z ed„ «      Zy	)z'Blueprint for connecting to Twitch API.é    )Úg)Ú
LocalProxy)ÚOAuth2ConsumerBlueprint)ÚOAuth2Sessionz,Kerry Hatcher <kerry.hatcher@protonmail.com>c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚClientIdHeaderOAuth2Sessionzd
    https://blog.twitch.tv/en/2016/05/05/client-id-required-for-kraken-api-calls-afbb8e95f843/
    c                 óV   •— t        ‰| �  |i |¤Ž | j                  | j                  d<   y )Nz	client-id)ÚsuperÚ__init__Ú	client_idÚheaders)ÚselfÚargsÚkwargsÚ	__class__s      €úR/var/www/timesheet/venv/lib/python3.12/site-packages/flask_dance/contrib/twitch.pyr   z$ClientIdHeaderOAuth2Session.__init__   s'   ø€ Ü‰Ñ˜$Ð) &Ò)Ø$(§N¡Nˆ�‰�[Ò!ó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__)r   s   @r   r   r      s   ø„ ñ÷3ð 3r   r   N)ÚscopeÚredirect_urlÚredirect_toÚ	login_urlÚauthorized_urlÚsession_classÚstorageÚrule_kwargsc                ó  ‡— t        dt        | ||dddddi|||||||	¬«      Šd‰j                  d	<   d
‰j                  d<   ‰j                  ‰_        ‰j
                  ‰j                  dœ‰_        ‰j                  ˆfd„«       }
‰S )aî  Make a blueprint for authenticating with Twitch using OAuth 2.

    This requires a client ID and client secret from Twitch.
    You should either pass them to this constructor, or make sure that your
    Flask application config defines them, using the variables
    :envvar:`TWITCH_OAUTH_CLIENT_ID` and :envvar:`TWITCH_OAUTH_CLIENT_SECRET`.

    Args:
        client_id (str): The client ID for your application on Twitch.
            Defaults to app config "TWITCH_OAUTH_CLIENT_ID".
        client_secret (str): The client Secret for your application on Twitch.
            Defaults to app config "TWITCH_OAUTH_CLIENT_SECRET".
        scope (list, optional): Comma-separated list of scopes for the OAuth token.
            Defaults to None.
        redirect_url (str): the URL to redirect to after the authentication
            dance is complete
        redirect_to (str): if ``redirect_url`` is not defined, the name of the
            view to redirect to after the authentication dance is complete.
            The actual URL will be determined by :func:`flask.url_for`
        login_url (str, optional): the URL path for the ``login`` view.
            Defaults to ``/twitch``
        authorized_url (str, optional): the URL path for the ``authorized`` view.
            Defaults to ``/twitch/authorized``.
        session_class (class, optional): The class to use for creating a
            Requests session. Defaults to
            :class:`~flask_dance.contrib.twitch.ClientIdHeaderOAuth2Session`.
        storage: A token storage class, or an instance of a token storage
                class, to use for this blueprint. Defaults to
                :class:`~flask_dance.consumer.storage.session.SessionStorage`.
        rule_kwargs (dict, optional): Additional arguments that should be passed when adding
            the login and authorized routes. Defaults to ``None``.

    Returns:
        :class:`~flask_dance.consumer.OAuth2ConsumerBlueprint` A :doc:`blueprint <flask:blueprints>` to attach to your Flask app.
    Útwitchzhttps://api.twitch.tv/helix/z%https://id.twitch.tv/oauth2/authorizez!https://id.twitch.tv/oauth2/tokenÚinclude_client_idT)r   Úclient_secretr   Úbase_urlÚauthorization_urlÚ	token_urlÚtoken_url_paramsr   r   r   r   r   r   r    ÚTWITCH_OAUTH_CLIENT_IDr   ÚTWITCH_OAUTH_CLIENT_SECRETr$   )r   r$   c                  ó0   •— ‰ j                   t        _        y ©N)Úsessionr   Úflask_dance_twitch)Ú	twitch_bps   €r   Úset_applocal_sessionz3make_twitch_blueprint.<locals>.set_applocal_sessiond   s   ø€ à(×0Ñ0ŒÕr   )	r   r   Úfrom_configr'   Úauto_refresh_urlr   r$   Úauto_refresh_kwargsÚbefore_app_request)r   r$   r   r   r   r   r   r   r   r    r0   r/   s              @r   Úmake_twitch_blueprintr5      s¶   ø€ ô` (ØÜØØ#ØØ/ØAØ5Ø-¨tÐ4Ø!ØØØ%Ø#ØØô!€Ið& *B€I×Ñ˜+Ñ&Ø-I€I×Ñ˜/Ñ*ð "+×!4Ñ!4€IÔà×(Ñ(Ø"×0Ñ0ñ%€IÔ!ð
 ×!Ñ!ó1ó "ð1ð Ðr   c                  ó"   — t         j                  S r,   )r   r.   © r   r   ú<lambda>r8   k   s   € œA×0Ñ0€ r   )NN)r   Úflaskr   Úwerkzeug.localr   Úflask_dance.consumerr   Úflask_dance.consumer.requestsr   Ú__maintainer__r   r5   r"   r7   r   r   ú<module>r>      sa   ðÙ -å Ý %å 8Ý 7à?€ô3 -ô 3ð ØðRð ØØØØØ-ØØôRñj 
Ñ0Ó	1�r   