Skip to main content

pwfauth

Official Python client for PWF Auth — license keys, hardware-ID binding, encrypted sessions with a server-driven kill switch, free trials, remote texts/slides, and OTA update checks.

PWF Auth is 100% free — every feature, unlimited, forever.

pip install pwfauth

Python 3.9+. One dependency (cryptography), because Python has no AES in its standard library; HTTP uses urllib from the stdlib rather than pulling in requests.

Quick start

import os
import sys
from pwfauth import PwfClient

client = PwfClient(os.environ["PWFAUTH_SECRET"])

def on_session_ended(error_code, message):
    """Ban, pause, expiry, HWID reset, revoke, maintenance, or an unreachable
    server. Actually stop here — logging alone leaves the licence unenforceable."""
    print(f"Session ended ({error_code}): {message}", file=sys.stderr)
    sys.exit(1)

client.on_session_ended = on_session_ended

login = client.login("XXXXX-XXXXX-XXXXX-XXXXX")
if not login.success:
    print(login.message, file=sys.stderr)   # safe to show the user
    sys.exit(1)

client.start_heartbeat()   # keeps the session alive AND enforces the kill switch

start_heartbeat() is what turns a one-time check into a live session. Revoke the key in your dashboard and on_session_ended fires on the user's machine within seconds — it does not wait for the next launch.

Reading the licence

lic = login.license
if lic.is_lifetime:
    print("Lifetime licence")
else:
    print(f"Expires {lic.expires_at:%Y-%m-%d}{lic.days_remaining} day(s) left")

expires_at is None for lifetime keys — the server sends expires_at: null, and treating that as a date is the most common integration bug against this API. The is_lifetime flag exists so you never have to.

Feature flags

if login.get_boolean("pro_export"):
    enable_export()

Handles the 1 / 0 / "true" forms the dashboard can store.

Checking a key without using a device seat

status = client.check_key(key)   # no session opened, no seat consumed

Hardware ID

from pwfauth import get_hardware_id
print(get_hardware_id())

Derived identically to the .NET and Node clients, so the same machine counts as one device under any SDK — switching languages does not burn a second seat against the licence's device limit.

Everything else

Method What it does
login(key) / logout() Open and close a session
check_key(key) Read a key's state without a session
heartbeat() One manual beat
start_heartbeat() / stop_heartbeat() The background loop
create_trial() Issue a free trial for this machine
request_hardware_reset(key, reason) Ask an admin to unbind a device
get_app_info() / get_texts() / get_slides() Remote app content
check_update(version) OTA update check
register_account() / account_login() / change_account_password() User accounts
post_envelope() / get_envelope() / post_plain() Raw transports

Error codes

from pwfauth import PwfErrorCodes, ends_session

if ends_session(res.error_code):
    sign_out()

ends_session() returns False for a code it does not recognise, on purpose: an unknown code is far more likely to be a new transient condition than a new way of being banned, and locking a paying user out on a guess is the worse failure.

Links

MIT

Download files

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

Source Distribution

pwfauth-1.0.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

pwfauth-1.0.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file pwfauth-1.0.1.tar.gz.

File metadata

  • Download URL: pwfauth-1.0.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for pwfauth-1.0.1.tar.gz
Algorithm Hash digest
SHA256 48cf5000ad2aeb8f99ed3dc3c550be5cbe5e7792157aca6c8ec15f017cc2f8be
MD5 d1e4e393ab836b19dfc3536629b7cf93
BLAKE2b-256 24acea08277fae40e734c2003164e7a92d902e87b7d5378c1212228c197c5622

See more details on using hashes here.

File details

Details for the file pwfauth-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pwfauth-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for pwfauth-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb197c692a90536b43069ddd605bb69ae4a7df5f8b3a7f28b95a2b01a6c24c74
MD5 f857611230b27b3e39da3441824998c4
BLAKE2b-256 9c2fbbdd1762d5b3196b270baa16db06a13603509ed32f5622cfe1d0078c0704

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page