Metered Licensing

Metered Licensing

Here are the simple steps to use the Metered class.

  1. Create an instance of Metered class.
  2. Pass public & private keys to set_metered_key method.
  3. Do processing (perform task).
  4. Call method get_consumption_quantity of the Metered class.
  5. It will return the amount/quantity of API requests that you have consumed so far.

Following is the sample code demonstrating how to set metered public and private key.

from aspose.imaging import Metered
metered = Metered()
try:
# Specify public and private metered keys
metered.set_metered_key("<public_key>", "<private_key>");
# get_consumption_quantity of the Metered class.
credit = Metered.get_consumption_credit()
quanity = Metered.get_consumption_quantity()
except Exception as err:
print("Need to set public and private metered keys, please request them")
print(str(err))