
    D6i                         d dl mZmZ d dlmZ d dlmZ d dlm	Z	m
Z
 dZde Z G d de
      Z	 	 dd
d	d	d	d	d	d	d	d	d	dZ ed       Zy	)    )grequest)
LocalProxy)__version__)OAuth2ConsumerBlueprintOAuth2Sessionz%Jimmy Hedman <jimmy.hedman@gmail.com>zFlask-Dance/c                        e Zd Z fdZ xZS )StravaOAuth2Sessionc                 d    t        |   |ddt        j                  j	                  d      d|S )NTPOSTcode)include_client_idmethodr   )superfetch_tokenr   argsget)selfr   kwargs	__class__s      ]/home/azureuser/techstart-app/venv/lib/python3.12/site-packages/flask_dance/contrib/strava.pyr   zStravaOAuth2Session.fetch_token   s>    w"  #!!&)

 
 	
    )__name__
__module____qualname__r   __classcell__)r   s   @r   r
   r
      s    
 
r   r
   Nread)	scoperedirect_urlredirect_to	login_urlauthorized_urlsession_classstorage
user_agentrule_kwargsc       	             t        dt        | ||dddd|||||xs t        ||
      dj                  d<   dj                  d	<   |	_        j
                  fd
       }S )a  
    Make a blueprint for authenticating with Strava using OAuth 2. This requires
    a client ID and client secret from Strava. You should either pass them to
    this constructor, or make sure that your Flask application config defines
    them, using the variables :envvar:`STRAVA_OAUTH_CLIENT_ID` and
    :envvar:`STRAVA_OAUTH_CLIENT_SECRET`.

    Args:
        client_id (str): The client ID for your application on Strava.
        client_secret (str): The client secret for your application on Strava
        scope (str, optional): space-separated list of scopes for the OAuth token
            Defaults to ``identity``
        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 ``/strava``
        authorized_url (str, optional): the URL path for the ``authorized`` view.
            Defaults to ``/strava/authorized``.
        session_class (class, optional): The class to use for creating a
            Requests session. Defaults to
            :class:`~flask_dance.contrib.strava.StravaOAuth2Session`.
        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`.
        user_agent (str, optional): User agent for the requests to Strava API.
            Defaults to ``Flask-Dance/{{version}}``.
        rule_kwargs (dict, optional): Additional arguments that should be passed when adding
            the login and authorized routes. Defaults to ``None``.

    :rtype: :class:`~flask_dance.consumer.OAuth2ConsumerBlueprint`
    :returns: A :doc:`blueprint <flask:blueprints>` to attach to your Flask app.
    stravazhttps://www.strava.com/api/v3z-https://www.strava.com/api/v3/oauth/authorizez)https://www.strava.com/api/v3/oauth/token)	client_idclient_secretr   base_urlauthorization_url	token_urlauto_refresh_urlr   r    r!   r"   r#   r$   r&   STRAVA_OAUTH_CLIENT_IDr)   STRAVA_OAUTH_CLIENT_SECRETr*   c                  0     j                   t        _        y N)sessionr   flask_dance_strava)	strava_bps   r   set_applocal_sessionz3make_strava_blueprint.<locals>.set_applocal_sessionc   s    (00r   )r   r   r
   from_configr%   before_app_request)r)   r*   r   r   r    r!   r"   r#   r$   r%   r&   r6   r5   s               @r   make_strava_blueprintr9      s    d (#0I=D!%#:':!I& *BI+&-II/*%I!!1 "1 r   c                  "    t         j                  S r2   )r   r4    r   r   <lambda>r<   j   s    A00 r   )NN)flaskr   r   werkzeug.localr   flask_dancer   _flask_dance_versionflask_dance.consumerr   r   __maintainer__DEFAULT_USER_AGENTr
   r9   r(   r;   r   r   <module>rD      sr     % ; G8 $$8#9: 	
- 	
 N Nb 
0	1r   