def encode_authorization(
    method: str, url: str, headers: Dict[str, str], access_key: str, secret_key: str
) -> str:
    """
    Compute the signature for the API.
    Document: https://cloud.baidu.com/doc/Reference/s/Njwvz1wot .

    :param method: HTTP method.
    :param url: HTTP URL with query string.
    :param headers: HTTP headers.
    :param access_key: The Access Key obtained from the Security Authentication Center of Baidu Intelligent Cloud Console.
    :param secret_key: The Secret Key paired with the Access Key.
    :return: The Authorization value.
    """
    timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    expire_in_seconds = 60

    url_parsed = urllib.parse.urlparse(url)

    auth_string_prefix = f"bce-auth-v1/{access_key}/{timestamp}/{expire_in_seconds}"

    canonical_url = urllib.parse.quote(url_parsed.path)
    canonical_query = encode_canonical_query(url_parsed.query)
    signed_headers, canonical_headers = encode_canonical_headers(
        headers, url_parsed.hostname
    )
    canonical_request = (
        method.upper()
        + "\n"
        + canonical_url
        + "\n"
        + canonical_query
        + "\n"
        + canonical_headers
    )

    signing_key = hmac.new(
        secret_key.encode(), auth_string_prefix.encode(), hashlib.sha256
    ).hexdigest()
    signature = hmac.new(
        signing_key.encode(), canonical_request.encode(), hashlib.sha256
    ).hexdigest()

    return f"bce-auth-v1/{access_key}/{timestamp}/{expire_in_seconds}/{signed_headers}/{signature}"

    Compute the signature for the API.
    Document: https://cloud.baidu.com/doc/Reference/s/Njwvz1wot .

    :param method: HTTP method.
    :param url: HTTP URL with query string.
    :param headers: HTTP headers.
    :param access_key: The Access Key obtained from the Security Authentication Center of Baidu Intelligent Cloud Console.
    :param secret_key: The Secret Key paired with the Access Key.
    :return: The Authorization value.
    
llama-index-utils/llama-index-utils-qianfan/llama_index/utils/qianfan/authorization.py