# Copy the example environment filecp examples.env .env# Edit .env with your credentialsexport USERNAME="your_hrmless_username"export PASSWORD="your_hrmless_password"# Load the environmentsource .env
Quick Start
Basic Usage
Code
from modules.hrmless import HRMLess# Initialize client (authenticates automatically)client = HRMLess()# Get your organization IDorg_id = client.get_org_id()# List all positionspositions = client.get_positions(org_id)for position in positions: print(f"Position: {position['name']}")
That's it! The client handles all authentication and token refresh automatically.
With Credentials
You can also pass credentials directly:
Code
from modules.hrmless import HRMLessclient = HRMLess( username="your_username", password="your_password")
Running Examples
The repository includes a comprehensive example script demonstrating all API functionality:
Code
# Make sure your credentials are setsource .env# Run the examplespython examples.py
This will demonstrate:
✅ Authentication (automatic)
✅ Organization settings management
✅ Position CRUD operations
✅ Candidate management
✅ Interview scheduling and tracking
API Reference
Authentication
The HRMLess client automatically handles authentication:
Code
from modules.hrmless import HRMLess, AuthenticationErrortry: client = HRMLess() print(f"Authenticated as: {client.user_id}")except AuthenticationError as e: print(f"Authentication failed: {e}")
import logging# Enable debug logginglogging.basicConfig(level=logging.INFO)from modules.hrmless import HRMLessclient = HRMLess()# You'll see authentication and API request logs
Best Practices
1. Initialize Once, Reuse Everywhere
Code
# ✅ Good - Initialize onceclient = HRMLess()positions = client.get_positions(org_id)candidates = client.get_candidates(org_id, position_id)# ❌ Bad - Don't create multiple clientsfor position in positions: client = HRMLess() # Wasteful! candidates = client.get_candidates(org_id, position['id'])
2. Use Context Managers
Code
# ✅ Good - Automatic cleanupwith HRMLess() as client: data = client.get_positions(org_id)# ❌ Okay but manualclient = HRMLess()data = client.get_positions(org_id)# Remember to cleanup if needed
3. Handle Errors Gracefully
Code
# ✅ Good - Specific error handlingtry: position = client.create_position(org_id, data)except APIError as e: if e.status_code == 422: print("Validation error: check your data") else: print(f"API error: {e}")# ❌ Bad - Too broadtry: position = client.create_position(org_id, data)except: print("Something went wrong")
4. Validate Data Before Sending
Code
# ✅ Good - Validate firstdef create_candidate_safely(client, org_id, position_id, data): required_fields = ['first_name', 'last_name', 'email'] for field in required_fields: if not data.get(field): raise ValueError(f"Missing required field: {field}") return client.create_candidate(org_id, position_id, data)
Repository Structure
Code
public-examples/├── modules/│ └── hrmless.py # Unified API client├── examples.py # Comprehensive examples├── test_client.py # Quick test script├── README.md # Full documentation├── MIGRATION.md # Migration guide└── examples.env # Environment template
Next Steps
Ready to build? Check out the API Playground to explore all available endpoints interactively.