Employment Hero SDK
Simple, lightweight and efficient Python client wrapper for interacting with the Employment Hero/Key Pay API. It provides a consistent, chainable interface for both synchronous and asynchronous operations, making it easy to fetch, create, update, and delete resources....
Features
- Simple, Chainable API: Navigate endpoints with intuitive chaining (e.g.
client.business("biz123").employees.fetch("emp456")). - Synchronous and Asynchronous Support: Choose the mode that best fits your application's needs.
- Built-in Pagination: Easily fetch all pages of data using built-in pagination methods.
- Caching: Cache business listings to reduce unnecessary API calls.
- Error Handling: Receive informative exceptions for API errors.
- Throttling: Automatically handle rate limiting and backoff.
Installation
You can install the package directly from PyPI:
pip install employment-hero-sdk
Usage
Synchronous Example
from employment_hero_sdk import EmploymentHeroClient
# Initialize the client with your API key
client = EmploymentHeroClient(api_key="your_api_key")
# Retrieve all available businesses (cached)
businesses = client.business() # Returns a list of Business objects
for biz in businesses:
print(biz)
# Retrieve a specific business by ID
biz = client.business("business_id_123")
# Fetch an employee from a specific business
employee = biz.employee("employee_id_456")
print(f"Employee: {employee.full_name}")
Asynchronous Example
import asyncio
from employment_hero_sdk import EmploymentHeroClient
async def main():
# Initialize the client with your API key
client = EmploymentHeroClient(api_key="your_api_key")
# Retrieve all available businesses asynchronously
businesses = await client.business() # Returns a list of Business objects
for biz in businesses:
print(biz)
# Retrieve a specific business by ID asynchronously
biz = await client.business("business_id_123")
# Fetch an employee from the specific business asynchronously
employee = await biz.employee("employee_id_456")
print(f"Employee: {employee.full_name}")
asyncio.run(main())
Dynamic Paths
We also dynamically load paths if there isn't an api model for the path, which will return data if the path exists.
The data can be returned as a list of dictionaries or as a pandas DataFrame if dataframe=True is passed as a keyword argument.
import datetime
from employment_hero_sdk import EmploymentHeroClient
EMPLOYMENT_HERO_API_KEY = "api_key"
client = EmploymentHeroClient(api_key=EMPLOYMENT_HERO_API_KEY)
for business in client.business().values():
print(business.show())
for employee in business.employee():
print(employee.show())
opening_balances = employee.openingbalances() #/api/v2/business/{busness_id}/employee/{employee_id}/openingbalances is a valid path
print(opening_balances)
break
# or snake case will split into a path e.g. report_birthday -> report/birthday?{kwargs}
birthday_report = business.report_birthday(fromDate=datetime.date(day=1, month=1, year=2025), toDate=datetime.date.today())
# or include dataframe=True to return a pandas dataframe
timesheet_report_df = business.report_timesheet(
dataframe=True,
**{
'request.fromDate': datetime.date(day=1, month=1, year=2025),
'request.toDate': datetime.date.today()
}
)
License
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. You are free to use, share, and modify the software for non-commercial purposes only.
Metadata
Release files for employment-hero-sdk 0.1.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| employment_hero_sdk-0.1.24.tar.gz | 601.3 kB | Without provenance | Details for employment_hero_sdk-0.1.24.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| employment_hero_sdk-0.1.24-py3-none-any.whl | Python 3 | none | any | Details for employment_hero_sdk-0.1.24-py3-none-any.whl |
Total release size: 2.5 MB
Release files / employment_hero_sdk-0.1.24.tar.gz
| Download URL | employment_hero_sdk-0.1.24.tar.gz |
|---|---|
| Size | 601.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2dbb739b6ce98fb86742739f03a36844b7630e2b3d2088bae049348821355a3
|
|
BLAKE2b-256 checksum How to use checksums |
70fd94740d46f98a17150b71317ee79a8b1a405103665c160513160f2a562157
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.13.3 Darwin/25.2.0
|
Release files / employment_hero_sdk-0.1.24-py3-none-any.whl
| Download URL | employment_hero_sdk-0.1.24-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64fc6929873c17e6734c8789bda1dae486091117988139ecff72b50b1f1e52ff
|
|
BLAKE2b-256 checksum How to use checksums |
1f0f18c726413ff9bc8f0a0557a0825d7a3c5914f187ff0485fded1520b11eca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.13.3 Darwin/25.2.0
|
Security for employment-hero-sdk 0.1.24
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.