按量许可

按量许可

以下是使用 Metered 类的简单步骤。

  1. 创建 Metered 类的实例。
  2. 将公钥和私钥传递给 SetMeteredKey 方法。
  3. 进行处理(执行任务)。
  4. 调用 Metered 类的 GetConsumptionQuantity 方法。
  5. 它将返回到目前为止您消耗的 API 请求量/数量。

以下是示例代码,演示如何设置按量的公钥和私钥。

import aspose.cad as cad
// Access the setMeteredKey property and pass public and private keys as parameters
Aspose.CAD.Metered.SetMeteredKey("PublicKey", "PrivateKey");
// Get metered data amount before calling API
amountbefore = cad.Metered.get_consumption_quantity()
// Display information
print("Amount Consumed Before: " + amountbefore.ToString());
// Do processing
image = cad.Image.load("file.dwg");
// Get metered data amount After calling API
amountafter = cad.Metered.get_consumption_quantity()
// Display information
print("Amount Consumed After: " + amountafter);