Official Python SDK for Planly subscription validation
Project description
Planly Python SDK
Official Python SDK for Planly subscription validation.
Installation
pip install planly
Quick Start
from planly import Planly
# Initialize the client
client = Planly("pln_your_api_key")
# Check subscription
result = client.check("user@example.com")
if result.valid:
print(f"Active subscription: {result.plan_name}")
else:
print("No active subscription")
Features
- Built-in Caching: Configurable TTL to reduce API calls
- Auto Retries: Exponential backoff for reliability
- Type Hints: Full IDE support with type annotations
- Thread-Safe: Safe for multi-threaded applications
Configuration
client = Planly(
api_key="pln_your_api_key",
cache_ttl=300, # Cache for 5 minutes (default)
max_retries=3, # Retry attempts (default)
timeout=10, # Request timeout in seconds (default)
)
API Reference
check(customer_email, use_cache=True, force_refresh=False)
Returns a SubscriptionResult with:
valid: bool - Whether subscription is activestatus: str - 'active', 'trial', 'grace_period', 'expired', 'canceled'plan_name: str - Name of the subscription plancurrent_period_end: str - When the current period endsdays_remaining: int - Days until expiration
is_valid(customer_email)
Quick boolean check. Returns True if subscription is valid.
invalidate(customer_email)
Remove a specific email from the cache.
clear_cache()
Clear all cached results.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
planly-1.0.1.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file planly-1.0.1.tar.gz.
File metadata
- Download URL: planly-1.0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0134c94fc9b1dea686f6be9e2bff8ffd303f9789ba38ec10159385e84523a5ae
|
|
| MD5 |
8277c55763c72dd9879c2f8561d5e322
|
|
| BLAKE2b-256 |
a2b43b014c13827adec33ae24b76cb3f39f87714383eabe344e9656bcd4c7116
|
File details
Details for the file planly-1.0.1-py3-none-any.whl.
File metadata
- Download URL: planly-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
491865cc528e4f15491f452ece9f59a58b4021cc436f217e6ae3530028104d31
|
|
| MD5 |
23afa598774a96f881c68179e186fbf4
|
|
| BLAKE2b-256 |
e833ec699e83d62a77931f3222258d696192b7777e13d7172ddd6cb7284d10b2
|