Activating Nutrient Python SDK with a license key
Activate Nutrient Python SDK with your license key before you call any other SDK API. This step enables licensed features in your application.
Download sampleHow Nutrient supports this workflow
Nutrient Python SDK provides a license activation API.
You don’t need to manage:
- License validation logic
- Feature configuration logic
- Multi-step SDK initialization flow
Register your key once at startup, then continue with document operations.
Complete implementation
This example shows how to register a license key and then run an SDK operation.
Import the required Nutrient classes:
from nutrient_sdk import Licensefrom nutrient_sdk import Documentfrom nutrient_sdk import NutrientExceptionRegister the key before any other SDK usage. Replace the empty string with your license key. Catch NutrientException to handle activation or runtime failures:
def main(): try: # Initialize the SDK with your license key before using any other SDK classes # Replace the empty string with your license key: License.register_key("YOUR_LICENSE_KEY_GOES_HERE") License.register_key("")
# Now you can use the SDK - example: convert a document with Document.open("input.pdf") as document: document.export_as_pdf("output.pdf") print("Successfully converted to output.pdf") except NutrientException as e: print(f"Error: {e}")
if __name__ == "__main__": main()Summary
The activation flow has two steps:
- Call
License.register_key()before any other SDK usage. - Run SDK operations after registration.
Nutrient handles license validation and feature enablement, so you don’t need to manage SDK initialization state yourself.
You can download this sample package to run the example locally.