A Python client library for interacting with the Luminate Music API. This client handles authentication and provides convenient methods for making API requests.
- Automatic authentication and token management
- Support for all HTTP methods (GET, POST, PUT, DELETE)
- Token auto-refresh when expired
- Simple and intuitive API
- Type hints for better IDE support
- Comprehensive error handling
-
Clone this repository or download the source code
-
Install dependencies:
pip install -r requirements.txt- Copy the
.env.examplefile to.env:
cp .env.example .env- Edit
.envand add your Luminate API credentials:
LUMINATE_API_KEY=your_api_key_here
LUMINATE_USERNAME=your_username_here
LUMINATE_PASSWORD=your_password_here
To obtain API credentials for the Luminate Music API:
- Contact [email protected] to request API access
- Once approved, you'll receive:
- API Key
- Username
- Password
from luminate_client import LuminateClient, LuminateAPIError
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Initialize the client
client = LuminateClient(
api_key=os.getenv("LUMINATE_API_KEY"),
username=os.getenv("LUMINATE_USERNAME"),
password=os.getenv("LUMINATE_PASSWORD")
)
try:
# The client will automatically authenticate on the first request
response = client.get('/your/endpoint', params={'key': 'value'})
print(response)
except LuminateAPIError as e:
print(f"API Error: {e}")# Simple GET request
response = client.get('/endpoint')
# GET request with query parameters
response = client.get('/endpoint', params={
'param1': 'value1',
'param2': 'value2'
})response = client.post('/endpoint', data={
'key1': 'value1',
'key2': 'value2'
})response = client.put('/endpoint', data={
'key1': 'updated_value'
})response = client.delete('/endpoint')While the client automatically authenticates when needed, you can manually authenticate:
token = client.authenticate()
print(f"Authentication token: {token}")Run the basic usage example:
python examples/basic_usage.py.
├── luminate_client/
│ ├── __init__.py # Package initialization
│ └── client.py # Main client class
├── examples/
│ └── basic_usage.py # Basic usage example
├── requirements.txt # Project dependencies
├── .env.example # Example environment variables
└── README.md # This file
Initialize the Luminate API client.
Parameters:
api_key(str): Your Luminate API keyusername(str): Your Luminate usernamepassword(str): Your Luminate passwordbase_url(str, optional): Base URL for the API
Manually authenticate with the API and obtain an access token.
Returns: Authentication token string
Raises: LuminateAPIError if authentication fails
Make a GET request to the API.
Parameters:
endpoint(str): The API endpoint pathparams(dict, optional): Query parameters
Returns: JSON response as dictionary
Make a POST request to the API.
Parameters:
endpoint(str): The API endpoint pathdata(dict, optional): Request body data
Returns: JSON response as dictionary
Make a PUT request to the API.
Parameters:
endpoint(str): The API endpoint pathdata(dict, optional): Request body data
Returns: JSON response as dictionary
Make a DELETE request to the API.
Parameters:
endpoint(str): The API endpoint path
Returns: JSON response as dictionary
The client raises LuminateAPIError for API-related errors:
from luminate_client import LuminateAPIError
try:
response = client.get('/endpoint')
except LuminateAPIError as e:
print(f"An error occurred: {e}")- Python 3.7+
- requests >= 2.31.0
- python-dotenv >= 1.0.0
For API access or authentication issues, contact [email protected]
This project is provided as-is for use with the Luminate Music API.