CloudStackAIO/CloudStack.py
def _sign(self, url_parameters: dict) -> dict:
        """
        According to the CloudStack documentation, each request needs to be signed in order to authenticate the user
        account executing the API command. The signature is generated using a combination of the api secret and a SHA-1
        hash of the url parameters including the command string. In order to generate a unique identifier, the url
        parameters have to be transformed to lower case and ordered alphabetically.

        :param url_parameters: The url parameters of the API call including the command string
        :type url_parameters: dict
        :return: The url parameters including a new key, which contains the signature
        :rtype: dict
        """
        if url_parameters:
            url_parameters.pop('signature', None)  # remove potential existing signature from url parameters
            request_string = urlencode(sorted(url_parameters.items()), safe='.-*_', quote_via=quote).lower()
            digest = hmac.new(self.api_secret.encode('utf-8'), request_string.encode('utf-8'), hashlib.sha1).digest()
            url_parameters['signature'] = base64.b64encode(digest).decode('utf-8').strip()
        return url_parameters
def _sign(self, url_parameters: dict) -> dict:
        if url_parameters:
            url_parameters.pop('signature', None)  # remove potential existing signature from url parameters
            request_string = urlencode(sorted(url_parameters.items()), safe='.-*_', quote_via=quote).lower()
            digest = hmac.new(self.api_secret.encode('utf-8'), request_string.encode('utf-8'), hashlib.sha1).digest()
            url_parameters['signature'] = base64.b64encode(digest).decode('utf-8').strip()
        return url_parameters
def _sign ( self , url_parameters : dict ) -> dict : if url_parameters : url_parameters . pop ( 'signature' , None ) # remove potential existing signature from url parameters request_string = urlencode ( sorted ( url_parameters . items ( ) ) , safe = '.-*_' , quote_via = quote ) . lower ( ) digest = hmac . new ( self . api_secret . encode ( 'utf-8' ) , request_string . encode ( 'utf-8' ) , hashlib . sha1 ) . digest ( ) url_parameters [ 'signature' ] = base64 . b64encode ( digest ) . decode ( 'utf-8' ) . strip ( ) return url_parameters
According to the CloudStack documentation, each request needs to be signed in order to authenticate the user
        account executing the API command. The signature is generated using a combination of the api secret and a SHA-1
        hash of the url parameters including the command string. In order to generate a unique identifier, the url
        parameters have to be transformed to lower case and ordered alphabetically.

        :param url_parameters: The url parameters of the API call including the command string
        :type url_parameters: dict
        :return: The url parameters including a new key, which contains the signature
        :rtype: dict
According to the CloudStack documentation each request needs to be signed in order to authenticate the user account executing the API command . The signature is generated using a combination of the api secret and a SHA - 1 hash of the url parameters including the command string . In order to generate a unique identifier the url parameters have to be transformed to lower case and ordered alphabetically .