def __get_gaas_hmac_headers(self, method, url, date=None, body=None,
                                secret=None, userId=None):
        """Note: this documentation was copied for the Java client for GP.

        Generate GaaS HMAC credentials used for HTTP Authorization header.
        GaaS HMAC uses HMAC SHA1 algorithm signing a message composed by:

        (HTTP method)[LF]       (in UPPERCASE)
        (Target URL)[LF]
        (RFC1123 date)[LF]
        (Request Body)

        If the request body is empty, it is simply omitted,
        the 'message' then ends with new line code [LF].

        The format for HTTP Authorization header is:

        "Authorization: GaaS-HMAC (user ID):(HMAC above)"

        For example, with user "MyUser" and secret "MySecret",
        the method "POST",
        the URL "https://example.com/gaas",
        the date "Mon, 30 Jun 2014 00:00:00 GMT",
        the body '{"param":"value"}',
        the following text to be signed will be generated:

        POST
        https://example.com/gaas
        Mon, 30 Jun 2014 00:00:00 GMT
        {"param":"value"}

        And the resulting headers are:

        Authorization: GaaS-HMAC MyUser:ONBJapYEveDZfsPFdqZHQ64GDgc=
        Date: Mon, 30 Jun 2014 00:00:00 GMT

        The HTTP Date header, matching the one included in the message
        to be signed, is required for GaaS HMAC authentication. GaaS
        authentication code checks the Date header value and if it's too old,
        it rejects the request.
        """
        if not date:
            date = self.__get_RFC1123_date()

        message = str(method) + '\n' + \
            str(url) + '\n' + \
            str(date) + '\n'
        if body:
            message += str(body)

        if not secret:
            secret = self.__serviceAccount.get_password()
        secret = bytes(secret.encode(self.__ENCODINGFORMAT))
        message = bytes(message.encode(self.__ENCODINGFORMAT))
        digest = hmac.new(secret, message, sha1).digest()
        urlSafeHmac = base64.b64encode(digest).strip()

        if not userId:
            userId = self.__serviceAccount.get_user_id()
        urlSafeHmac = urlSafeHmac.strip().decode(self.__ENCODINGFORMAT)
        authorizationValue = 'GP-HMAC ' + userId + ':' + urlSafeHmac

        headers = {
            self.__AUTHORIZATION_HEADER_KEY: str(authorizationValue),
            self.__DATE_HEADER_KEY: str(date)
        }

        return headers
Note: this documentation was copied for the Java client for GP.

        Generate GaaS HMAC credentials used for HTTP Authorization header.
        GaaS HMAC uses HMAC SHA1 algorithm signing a message composed by:

        (HTTP method)[LF]       (in UPPERCASE)
        (Target URL)[LF]
        (RFC1123 date)[LF]
        (Request Body)

        If the request body is empty, it is simply omitted,
        the 'message' then ends with new line code [LF].

        The format for HTTP Authorization header is:

        "Authorization: GaaS-HMAC (user ID):(HMAC above)"

        For example, with user "MyUser" and secret "MySecret",
        the method "POST",
        the URL "https://example.com/gaas",
        the date "Mon, 30 Jun 2014 00:00:00 GMT",
        the body '{"param":"value"}',
        the following text to be signed will be generated:

        POST
        https://example.com/gaas
        Mon, 30 Jun 2014 00:00:00 GMT
        {"param":"value"}

        And the resulting headers are:

        Authorization: GaaS-HMAC MyUser:ONBJapYEveDZfsPFdqZHQ64GDgc=
        Date: Mon, 30 Jun 2014 00:00:00 GMT

        The HTTP Date header, matching the one included in the message
        to be signed, is required for GaaS HMAC authentication. GaaS
        authentication code checks the Date header value and if it's too old,
        it rejects the request.