Skip to content

Commit 9e98d80

Browse files
committed
api_key rename + bump 2.1.1
1 parent a3b688b commit 9e98d80

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

example.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
Example usage of the KeyMint Python SDK
33
44
Before running this example:
5-
1. Get your access token from: https://app.keymint.dev/dashboard/developer/access-tokens
5+
1. Get your API key from: https://app.keymint.dev
66
2. Get your product ID from your KeyMint dashboard
77
3. Set environment variables:
8-
export KEYMINT_ACCESS_TOKEN="your_token_here"
8+
export KEYMINT_API_KEY="your_token_here"
99
export KEYMINT_PRODUCT_ID="your_product_id_here"
1010
"""
1111

1212
import os
1313
import uuid
14-
from keymint import KeyMintSDK, KeyMintApiError
14+
from keymint import KeyMint, KeyMintApiError
1515

1616
def main():
1717
# Get credentials from environment variables
18-
access_token = os.environ.get('KEYMINT_ACCESS_TOKEN')
18+
api_key = os.environ.get('KEYMINT_API_KEY')
1919
product_id = os.environ.get('KEYMINT_PRODUCT_ID')
2020

21-
if not access_token:
22-
print("❌ Please set KEYMINT_ACCESS_TOKEN environment variable")
21+
if not api_key:
22+
print("❌ Please set KEYMINT_API_KEY environment variable")
2323
return
2424

2525
if not product_id:
@@ -30,7 +30,7 @@ def main():
3030
print("-" * 40)
3131

3232
# Initialize the SDK
33-
sdk = KeyMintSDK(access_token)
33+
sdk = KeyMint(api_key)
3434

3535
try:
3636
# 1. Create a customer

keymint/__init__.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
__all__ = ['KeyMint', 'KeyMintApiError', '__version__']
66

77
class KeyMint:
8-
def __init__(self, access_token: str, base_url: str = "https://api.keymint.dev"):
9-
if not access_token:
10-
raise ValueError("Access token is required to initialize the SDK.")
8+
def __init__(self, api_key: str, base_url: str = "https://api.keymint.dev"):
9+
if not api_key:
10+
raise ValueError("API key is required to initialize the SDK.")
1111

12-
self.access_token = access_token
12+
self.api_key = api_key
1313
self.base_url = base_url
1414
self.headers = {
15-
'Authorization': f'Bearer {self.access_token}',
15+
'Authorization': f'Bearer {self.api_key}',
1616
'Content-Type': 'application/json'
1717
}
1818

@@ -79,6 +79,30 @@ def deactivate_key(self, params: DeactivateKeyParams) -> DeactivateKeyResponse:
7979
"""
8080
return self._handle_request('POST', '/key/deactivate', params)
8181

82+
def floating_checkout(self, params: FloatingCheckoutParams) -> FloatingCheckoutResponse:
83+
"""
84+
Checks out a floating license seat.
85+
:param params: Parameters for checking out the license.
86+
:returns: The checkout response containing sessionId and sessionSecret.
87+
"""
88+
return self._handle_request('POST', '/key/checkout', params)
89+
90+
def floating_heartbeat(self, params: FloatingHeartbeatParams) -> FloatingHeartbeatResponse:
91+
"""
92+
Sends a heartbeat to keep a floating license session alive.
93+
:param params: Parameters for the heartbeat (includes rotating signature).
94+
:returns: The heartbeat response with extended expiry and new nonce.
95+
"""
96+
return self._handle_request('POST', '/key/heartbeat', params)
97+
98+
def floating_checkin(self, params: FloatingCheckinParams) -> FloatingCheckinResponse:
99+
"""
100+
Checks in a floating license session, releasing the seat.
101+
:param params: Parameters for checking in the license (includes rotating signature).
102+
:returns: The checkin confirmation.
103+
"""
104+
return self._handle_request('POST', '/key/checkin', params)
105+
82106
def get_key(self, params: GetKeyParams) -> GetKeyResponse:
83107
"""
84108
Retrieves detailed information about a specific license key.

keymint/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""KeyMint Python SDK version information."""
22

3-
__version__ = "2.1.0"
3+
__version__ = "2.1.1"
44
__author__ = "KeyMint"
55
__email__ = "cliff@keymint.dev"
66
__url__ = "https://github.com/keymint-dev/keymint-python"

0 commit comments

Comments
 (0)