Appearance
Keycrate Python SDK ​
Installation ​
bash
pip install keycrateQuick Start ​
python
from keycrate import configurate
client = configurate('https://api.keycrate.dev', 'your-app-id')
# Authenticate with license
result = client.authenticate(license='your-license-key')
if result['success']:
print('License verified!')
print(f"License key: {result['data']['key']}")
else:
print(f"Error: {result['message']}")Authentication ​
License Key ​
python
result = client.authenticate(license='your-license-key')Username & Password ​
python
result = client.authenticate(username='user@example.com', password='password123')With HWID (Hardware ID) ​
python
result = client.authenticate(license='your-license-key', hwid='device-id-12345')Registration ​
python
result = client.register(
license='your-license-key',
username='newuser@example.com',
password='securepassword'
)
if result['success']:
print('Registration successful!')
else:
print(f"Error: {result['message']}")API Reference ​
configurate(host, app_id) ​
Creates and returns a client instance.
Parameters:
host(str): Base URL of the APIapp_id(str): Your application ID
Returns: Client instance
client.authenticate(license=None, username=None, password=None, hwid=None) ​
Authenticate using either a license key or username/password.
Parameters:
license(str, optional): License keyusername(str, optional): Usernamepassword(str, optional): Passwordhwid(str, optional): Hardware ID
Returns: {'success': bool, 'message': str, 'data': dict or None}
Note: Either license OR (username + password) must be provided.
client.register(license, username, password) ​
Register credentials for a license.
Parameters:
license(str): License key (required)username(str): Username (required)password(str): Password (required)
Returns: {'success': bool, 'message': str, 'data': dict or None}
Response Structure ​
All endpoints return a response with the following structure:
python
{
'success': bool,
'message': str,
'data': {
'key': 'license-key-string',
'expires_at': '2025-12-31T23:59:59Z',
# Additional fields depending on the operation
}
}Error Handling ​
python
result = client.authenticate(license='key')
if not result['success']:
message = result['message']
data = result.get('data')
if 'expired' in message.lower():
print("Your license has expired")
if data and 'expires_at' in data:
print(f"Expired on: {data['expires_at']}")
elif 'hwid' in message.lower():
print("Device mismatch")
if data and data.get('hwid_reset_allowed'):
print("You can reset your HWID")
else:
print(f"Authentication failed: {message}")