SynologyDSM/SynologyDSM.py
def _login(self):
        """Build and execute login request"""
        api_path = "%s/auth.cgi?api=SYNO.API.Auth&version=2" % (
            self.base_url,
        )

        login_path = "method=login&%s" % (self._encode_credentials())

        url = "%s&%s&session=Core&format=cookie" % (
            api_path,
            login_path)
        result = self._execute_get_url(url, False)

        # Parse Result if valid
        if result is not None:
            self.access_token = result["data"]["sid"]
            self._debuglog("Authentication Succesfull, token: " +
                           str(self.access_token))
            return True
        else:
            self._debuglog("Authentication Failed")
            return False
def _login(self):
        api_path = "%s/auth.cgi?api=SYNO.API.Auth&version=2" % (
            self.base_url,
        )

        login_path = "method=login&%s" % (self._encode_credentials())

        url = "%s&%s&session=Core&format=cookie" % (
            api_path,
            login_path)
        result = self._execute_get_url(url, False)

        # Parse Result if valid
        if result is not None:
            self.access_token = result["data"]["sid"]
            self._debuglog("Authentication Succesfull, token: " +
                           str(self.access_token))
            return True
        else:
            self._debuglog("Authentication Failed")
            return False
def _login ( self ) : api_path = "%s/auth.cgi?api=SYNO.API.Auth&version=2" % ( self . base_url , ) login_path = "method=login&%s" % ( self . _encode_credentials ( ) ) url = "%s&%s&session=Core&format=cookie" % ( api_path , login_path ) result = self . _execute_get_url ( url , False ) # Parse Result if valid
 if result is not None : self . access_token = result [ "data" ] [ "sid" ] self . _debuglog ( "Authentication Succesfull, token: " + str ( self . access_token ) ) return True else : self . _debuglog ( "Authentication Failed" ) return False
Build and execute login request
Build and execute login request