Lập trình viên / Tra cứu
Python SDK: license và cập nhật phần mềm
SDK Python hiện phục vụ licensing v2 và cập nhật có chữ ký; chưa có Python Auth/Data SDK.
Tải và cài
Chủ cửa hàng mở sản phẩm → tích hợp/SDK → tải bộ SDK. Giải nén, dùng Python 3.14 và cài wheel trong ZIP vào venv ứng dụng. Chưa phát hành lên PyPI. Core không cần Django; updates extra thêm cryptography.
python -m pip install --no-index --no-deps PATH_TO_WHEEL
# Khi cần signed updates: cài wheel với extra [updates] và dependencies theo README.License v2
Giữ installation UUID bền vững, riêng mỗi cài đặt. Lưu device_token/generation/entitlement_id an toàn; không log. Không gọi đồng thời cùng state.
from whypik_client import WhyPikClient, LicenseError, NetworkError
client = WhyPikClient(shop_origin, product_uuid, timeout=5)
result = client.activate(installation_uuid, activation_code, name="My application")
result = client.check(installation_uuid, saved_device_token)
if result["features"].get("pro") is True:
perform_pro_action()
client.deactivate(installation_uuid, saved_device_token)Cập nhật signed
WhyPikUpdateClient dùng trusted_keys và platform/architecture/channel do ứng dụng cấu hình tin cậy. check_update → download_update → app kiểm tra artifact/staging → confirm_update. SDK không chạy artifact và không tự thay chương trình. verify_saved_receipt chứng minh bytes đã cài, không tự cấp license.
Xử lý lỗi
LicenseError.code/status đã lọc; NetworkError có thể xảy ra sau commit, SDK không tự retry. Activate giữ installation UUID, chỉ lưu response mới; deactivate chỉ xóa token sau success. Chạy network ngoài UI thread. HTTPS được xác minh; không tắt TLS. API licensing v3 có contract riêng, chưa được Python client này bao phủ.