def __init__(self, client_id, client_secret, redirect_uri, token=None, code=None, scope=None):
        """


        :param client_id [string]: Client id obtained during registration.
        :param client_secret [string]: Client secret obtained during registration.
        :param redirect_uri [string]: Redirect URI you registered as callback.
        :param token [dict]: Token dictionary, must include access_token and token_type.
        :param code [string]: Authorization code to get access token.
        :param scope [list]: List of scopes you wish to request access to.
        :raise UnsplashAuthError: OAuth2Session has OAuth2Error.
        """
        self.access_token_url = "%s/oauth/token" % self.BASE_AUTH_URL
        self.authorization_url = "%s/oauth/authorize" % self.BASE_AUTH_URL
        self.client_id = client_id
        self.client_secret = client_secret
        self.redirect_uri = redirect_uri
        self.token = None
        self.access_token = None
        self.is_authenticated = False
        self.scope_list = [
            "public",
            "read_user",
            "write_user",
            "read_photos",
            "write_photos",
            "write_likes",
            "write_followers",
            "read_collections",
            "write_collections"
        ]
        self.scope = scope or self.scope_list

        try:
            if token:
                self.oauth = OAuth2Session(
                    client_id=self.client_id, redirect_uri=self.redirect_uri, scope=self.scope, token=token
                )
                self.access_token = self.oauth.access_token
                self.token = token
                self.is_authenticated = True
            elif code:
                self.oauth = OAuth2Session(client_id=self.client_id, redirect_uri=self.redirect_uri, scope=self.scope)
                self.access_token = self.get_access_token(code)
                self.is_authenticated = True
        except OAuth2Error as e:
            raise UnsplashAuthError(e)
def __init__ ( self , client_id , client_secret , redirect_uri , token = None , code = None , scope = None ) : self . access_token_url = "%s/oauth/token" % self . BASE_AUTH_URL self . authorization_url = "%s/oauth/authorize" % self . BASE_AUTH_URL self . client_id = client_id self . client_secret = client_secret self . redirect_uri = redirect_uri self . token = None self . access_token = None self . is_authenticated = False self . scope_list = [ "public" , "read_user" , "write_user" , "read_photos" , "write_photos" , "write_likes" , "write_followers" , "read_collections" , "write_collections" ] self . scope = scope or self . scope_list try : if token : self . oauth = OAuth2Session ( client_id = self . client_id , redirect_uri = self . redirect_uri , scope = self . scope , token = token ) self . access_token = self . oauth . access_token self . token = token self . is_authenticated = True elif code : self . oauth = OAuth2Session ( client_id = self . client_id , redirect_uri = self . redirect_uri , scope = self . scope ) self . access_token = self . get_access_token ( code ) self . is_authenticated = True except OAuth2Error as e : raise UnsplashAuthError ( e )
:param client_id [string]: Client id obtained during registration.
        :param client_secret [string]: Client secret obtained during registration.
        :param redirect_uri [string]: Redirect URI you registered as callback.
        :param token [dict]: Token dictionary, must include access_token and token_type.
        :param code [string]: Authorization code to get access token.
        :param scope [list]: List of scopes you wish to request access to.
        :raise UnsplashAuthError: OAuth2Session has OAuth2Error.