Skip to main content

Client library to verify maXerial licenses via a local activation server and check licensed features.

Project description

maXerial-license-verification-python

A Python package for the communication interface between dockerized Python environments and the maXerial license activation server.

Usage

from maxerial_license_verifier import LicenseVerifier

# Initialize with license file path (Windows style for API calls)
verifier = LicenseVerifier(
    license_file_path="C:\\Users\\User\\Documents\\license.xml",
    server_ip="10.0.250.145",      # Optional, defaults to "127.0.0.1"
    server_port=61040,             # Optional, defaults to 61040
    server_endpoint="/api/verify_license"  # Optional, defaults to "/api/verify_license"
)

# Verify license via activation server
if verifier.verify_license():
    print("License verified successfully")
    
    # Check if a feature is enabled (uses Unix-style path internally)
    if verifier.check_feature("pro"):
        print("Pro feature is enabled")
else:
    print("License verification failed")

Examples

The examples/ folder contains small scripts you can run locally. These are not packaged or built with the library.

  • examples/mock_activation_server.py: Minimal Flask server that accepts the GET request expected by the client for testing purposes.
  • examples/basic_usage.py: Demonstrates calling verify_license() and check_feature().

Run the mock server

  1. Install Flask:
    python -m pip install Flask
    
  2. Start the server (defaults to port 61040; override with MOCK_SERVER_PORT):
    python examples/mock_activation_server.py
    

Run the client example

  1. Install the library in editable mode (or pip install .):
    python -m pip install -e .
    
  2. Optionally set env vars and run:
    export EXAMPLE_LICENSE_PATH=C:\\Users\\User\\Documents\\license.xml
    export EXAMPLE_FEATURE=feature_name_enabled
    export EXAMPLE_SERVER_IP=127.0.0.1
    export EXAMPLE_SERVER_PORT=61040
    python examples/basic_usage.py
    

The example prints the result of verify_license() and whether a feature is present in the XML. Ensure your license XML contains a <feature> entry matching EXAMPLE_FEATURE for a True result.

Build and publish to PyPI

  1. Ensure version is updated in pyproject.toml under [project] version.
  2. (Optional) Create and activate a clean virtual environment.
    python -m venv .venv
    source .venv/bin/activate
    
  3. Install packaging tools.
    python -m pip install --upgrade pip build twine
    
  4. Build the distribution (wheel + sdist).
    python -m build
    # Artifacts will be in ./dist/
    ls dist/
    
  5. Check the distribution files.
    python -m twine check dist/*
    
  6. (Recommended) Upload to TestPyPI first.
    # Create a token at https://test.pypi.org/manage/account/#api-tokens
    # Username: __token__
    # Password: pypi-AgENdGVzdC5weXBpLm9yZw... (your token)
    python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
    
  7. Install from TestPyPI to validate.
    python -m pip install --index-url https://test.pypi.org/simple/ --no-deps maxerial-license-verifier
    
  8. Upload to PyPI.
    # Create a token at https://pypi.org/manage/account/#api-tokens
    # Username: __token__
    # Password: pypi-AgENdHB5cGkub3Jn... (your token)
    python -m twine upload dist/*
    

Tips:

  • Consider tagging the release: git tag v0.1.0 && git push origin v0.1.0.
  • You can configure ~/.pypirc for saved credentials and repository aliases.
  • If re-uploading the same version, bump the version in pyproject.toml (PyPI does not allow overwriting files).

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

maxerial_license_verifier-0.3.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

maxerial_license_verifier-0.3.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file maxerial_license_verifier-0.3.0.tar.gz.

File metadata

File hashes

Hashes for maxerial_license_verifier-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a80afc0b6e32d563db9e7fdfbc3f4f4d9d28e497e8cb4875b9f27efc6b5ccdeb
MD5 4633af176caafb098dbf5ec94f4f8827
BLAKE2b-256 f46230c45c0dbd7f124a92728cd0f5b1496d81be85e16aeef539fd0f6381cf16

See more details on using hashes here.

File details

Details for the file maxerial_license_verifier-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for maxerial_license_verifier-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a40459f6389d5f08021cb78340d5f515e3563638fc972ab64f10a59a6bcf3634
MD5 ec2562a0a2e16c97adfd2d31075445e0
BLAKE2b-256 66cce71acc1ed5a13ee412aa63c4a50916757be5c820b1f84f8c068b8d7be692

See more details on using hashes here.

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