Skip to main content

PenguinTech License Server Python client

Project description

Penguin Tech License Client

PenguinTech License Server Python client for license validation and feature gating.

Installation

pip install penguin-licensing

# With Flask extras
pip install penguin-licensing[flask]

Usage

Basic License Validation

from penguin_licensing import LicenseClient

# Initialize client
client = LicenseClient(
    license_key="PENG-XXXX-XXXX-XXXX-XXXX-ABCD",
    product="elder"
)

# Validate license
info = client.validate()
print(f"License valid: {info.valid}")
print(f"Customer: {info.customer}")
print(f"Tier: {info.tier}")

Feature Gating

from penguin_licensing import get_license_client

client = get_license_client()

# Check specific feature
if client.check_feature("advanced_analytics"):
    # Feature is available
    pass

# Check tier requirement
if client.check_tier("enterprise"):
    # Has enterprise license or higher
    pass

Flask Integration

from flask import Flask
from penguin_licensing.decorators import license_required, feature_required

app = Flask(__name__)

@app.route('/api/v1/enterprise-feature')
@license_required('enterprise')
def enterprise_endpoint():
    return {"message": "Enterprise feature"}

@app.route('/api/v1/analytics')
@feature_required('advanced_analytics')
def analytics_endpoint():
    return {"data": "analytics"}

Environment Variables

LICENSE_KEY=PENG-XXXX-XXXX-XXXX-XXXX-ABCD
PRODUCT_NAME=elder
LICENSE_SERVER_URL=https://license.penguintech.io

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src tests
ruff check src tests

# Type check
mypy src

License

AGPL-3.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

penguin_licensing-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

penguin_licensing-0.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file penguin_licensing-0.1.0.tar.gz.

File metadata

  • Download URL: penguin_licensing-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for penguin_licensing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58dba3c178f609e511e88db69963a26eeaf15de506f713ffa66772463829e686
MD5 c53f496557d81886c4248ff86cbc406d
BLAKE2b-256 aec7b10a10fc1e4b3df93c5eff3bc6af78c1b8ffc8b9f2d026f0de5a1317f01d

See more details on using hashes here.

Provenance

The following attestation bundles were made for penguin_licensing-0.1.0.tar.gz:

Publisher: publish.yml on penguintechinc/penguin-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file penguin_licensing-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for penguin_licensing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8cc33381eb9450081a15607439a9506f27867c97eabaa8820b006607de35950f
MD5 ddee007af4ad8312ece89ae671d24a2a
BLAKE2b-256 16c59a82fbf70e3c09754b9445382b86ea19382093a223eb5032d839e0f22a44

See more details on using hashes here.

Provenance

The following attestation bundles were made for penguin_licensing-0.1.0-py3-none-any.whl:

Publisher: publish.yml on penguintechinc/penguin-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page