# KeyMint Python SDK
A professional, production-ready SDK for integrating with the KeyMint API in Python. Provides robust access to all major KeyMint features, with type hints and modern error handling.
## Features
- **Type hints**: Full type hint support for better IDE integration and code safety.
- **Comprehensive**: Complete API coverage for all KeyMint endpoints.
- **Consistent error handling**: All API errors are returned as structured objects or exceptions.
- **Security**: Credentials are always loaded from environment variables.
## Installation
Add the SDK to your project:
```bash
pip install keymint
```
## Usage
```python
import os
import keymint
access_token = os.environ.get('KEYMINT_ACCESS_TOKEN')
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
if not access_token or not product_id:
raise ValueError('Please set the KEYMINT_ACCESS_TOKEN and KEYMINT_PRODUCT_ID environment variables.')
sdk = keymint.KeyMint(access_token)
# Example: Create a key
result = sdk.create_key({ 'productId': product_id })
if result and 'key' in result:
key = result['key']
# ...
else:
# Handle error
pass
```
## Error Handling
All SDK methods return a dictionary. If an API call fails, the SDK raises a `KeyMintApiError` exception with `message`, `code`, and `status` attributes.
## API Methods
All methods return a dictionary.
### License Key Management
| Method | Description |
|------------------|-------------------------------------------------|
| `create_key` | Creates a new license key. |
| `activate_key` | Activates a license key for a device. |
| `deactivate_key` | Deactivates a device from a license key. |
| `get_key` | Retrieves detailed information about a key. |
| `block_key` | Blocks a license key. |
| `unblock_key` | Unblocks a previously blocked license key. |
### Customer Management
| Method | Description |
|-------------------------|--------------------------------------------------|
| `create_customer` | Creates a new customer. |
| `get_all_customers` | Retrieves all customers. |
| `get_customer_by_id` | Gets a specific customer by ID. |
| `get_customer_with_keys`| Gets a customer along with their license keys. |
| `update_customer` | Updates customer information. |
| `toggle_customer_status`| Toggles customer active status. |
| `delete_customer` | Permanently deletes a customer and their keys. |
For detailed parameter and response types, see the [KeyMint API docs](https://docs.keymint.dev) or use your IDE's autocomplete.
## License
MIT
## Support
For help, see [KeyMint API docs](https://docs.keymint.dev) or open an issue.
Raw data
{
"_id": null,
"home_page": "https://github.com/keymint-dev/keymint-python",
"name": "keymint",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "keymint license licensing api sdk drm software-licensing",
"author": "KeyMint",
"author_email": "admin@keymint.dev",
"download_url": "https://files.pythonhosted.org/packages/91/c7/1412d6da7d6ecf4615d371746abebe7e6a433fd3f0ae5813a44f724888c5/keymint-2.0.0.tar.gz",
"platform": null,
"description": "# KeyMint Python SDK\n\nA professional, production-ready SDK for integrating with the KeyMint API in Python. Provides robust access to all major KeyMint features, with type hints and modern error handling.\n\n## Features\n- **Type hints**: Full type hint support for better IDE integration and code safety.\n- **Comprehensive**: Complete API coverage for all KeyMint endpoints.\n- **Consistent error handling**: All API errors are returned as structured objects or exceptions.\n- **Security**: Credentials are always loaded from environment variables.\n\n## Installation\nAdd the SDK to your project:\n\n```bash\npip install keymint\n```\n\n## Usage\n\n```python\nimport os\nimport keymint\n\naccess_token = os.environ.get('KEYMINT_ACCESS_TOKEN')\nproduct_id = os.environ.get('KEYMINT_PRODUCT_ID')\n\nif not access_token or not product_id:\n raise ValueError('Please set the KEYMINT_ACCESS_TOKEN and KEYMINT_PRODUCT_ID environment variables.')\n\nsdk = keymint.KeyMint(access_token)\n\n# Example: Create a key\nresult = sdk.create_key({ 'productId': product_id })\nif result and 'key' in result:\n key = result['key']\n # ...\nelse:\n # Handle error\n pass\n```\n\n## Error Handling\nAll SDK methods return a dictionary. If an API call fails, the SDK raises a `KeyMintApiError` exception with `message`, `code`, and `status` attributes.\n\n## API Methods\n\nAll methods return a dictionary.\n\n### License Key Management\n\n| Method | Description |\n|------------------|-------------------------------------------------|\n| `create_key` | Creates a new license key. |\n| `activate_key` | Activates a license key for a device. |\n| `deactivate_key` | Deactivates a device from a license key. |\n| `get_key` | Retrieves detailed information about a key. |\n| `block_key` | Blocks a license key. |\n| `unblock_key` | Unblocks a previously blocked license key. |\n\n### Customer Management\n\n| Method | Description |\n|-------------------------|--------------------------------------------------|\n| `create_customer` | Creates a new customer. |\n| `get_all_customers` | Retrieves all customers. |\n| `get_customer_by_id` | Gets a specific customer by ID. |\n| `get_customer_with_keys`| Gets a customer along with their license keys. |\n| `update_customer` | Updates customer information. |\n| `toggle_customer_status`| Toggles customer active status. |\n| `delete_customer` | Permanently deletes a customer and their keys. |\n\nFor detailed parameter and response types, see the [KeyMint API docs](https://docs.keymint.dev) or use your IDE's autocomplete.\n\n## License\nMIT\n\n## Support\nFor help, see [KeyMint API docs](https://docs.keymint.dev) or open an issue.\n",
"bugtrack_url": null,
"license": null,
"summary": "Official Python SDK for KeyMint license management with comprehensive API coverage.",
"version": "2.0.0",
"project_urls": {
"Bug Reports": "https://github.com/keymint-dev/keymint-python/issues",
"Documentation": "https://docs.keymint.dev/sdks/python",
"Homepage": "https://keymint.dev",
"Source": "https://github.com/keymint-dev/keymint-python"
},
"split_keywords": [
"keymint",
"license",
"licensing",
"api",
"sdk",
"drm",
"software-licensing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "dff95d9cb9f65883f9a75b04a5fa5fa7097b84e7231a6168ae33fe6b1a5193f4",
"md5": "d365ee0762c190dbc0d81c6981fd4f10",
"sha256": "31ac29f6a25b04fd996e1da1f35431ee755cf87fe484ab8a5fe7688fe433aa10"
},
"downloads": -1,
"filename": "keymint-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d365ee0762c190dbc0d81c6981fd4f10",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 6247,
"upload_time": "2025-09-08T18:03:04",
"upload_time_iso_8601": "2025-09-08T18:03:04.022543Z",
"url": "https://files.pythonhosted.org/packages/df/f9/5d9cb9f65883f9a75b04a5fa5fa7097b84e7231a6168ae33fe6b1a5193f4/keymint-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "91c71412d6da7d6ecf4615d371746abebe7e6a433fd3f0ae5813a44f724888c5",
"md5": "cf9ae34b9548d0e0acade54f5c4a62ed",
"sha256": "786d70a2091058b6c070f8451e18f6e1a5a52b2062e4cf89afbfe88c1f808fd6"
},
"downloads": -1,
"filename": "keymint-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "cf9ae34b9548d0e0acade54f5c4a62ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5735,
"upload_time": "2025-09-08T18:03:05",
"upload_time_iso_8601": "2025-09-08T18:03:05.056539Z",
"url": "https://files.pythonhosted.org/packages/91/c7/1412d6da7d6ecf4615d371746abebe7e6a433fd3f0ae5813a44f724888c5/keymint-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 18:03:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "keymint-dev",
"github_project": "keymint-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "keymint"
}