按量许可
Contents
[
Hide
]Aspose.CAD 允许开发者使用按量密钥。这是一种新的许可机制。新的许可机制将与现有的许可方法一起使用。希望根据 API 功能的使用量进行收费的客户可以使用按量许可。有关更多详情,请参阅 按量许可常见问题解答 部分。
按量许可
以下是使用 Metered 类的简单步骤。
- 创建 Metered 类的实例。
- 将公钥和私钥传递给 SetMeteredKey 方法。
- 进行处理(执行任务)。
- 调用 Metered 类的 GetConsumptionQuantity 方法。
- 它将返回到目前为止您消耗的 API 请求量/数量。
以下是示例代码,演示如何设置按量的公钥和私钥。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |