Skip to main content

A lightweight, robust Python client for interacting with the CharlieHR API.

Project description

CharlieHR API Python Client

A lightweight, robust Python client for interacting with the CharlieHR API.
This client wraps common operations with built-in support for retries, pagination, and token-based authentication.


📦 Overview

This package provides an easy-to-use Python interface for the CharlieHR platform's v1 API.
It allows developers to interact with:

  • Employees
  • Teams
  • Offices
  • Salaries
  • Notes
  • Leave (PTO) requests
  • Bank accounts
  • Company information

The client also handles:

  • HTTP retries with exponential backoff
  • Token-based authentication
  • Automatic pagination over multiple pages of API responses

🚀 Features

  • Simple API methods for common CharlieHR objects.
  • Automatic retrying of failed requests (e.g., 429, 500, 503 errors).
  • Built-in pagination to fetch all results transparently.
  • POST/GET/PUT/DELETE request support with payloads.
  • Rich permissions management for note types.

📋 Dependencies

Install dependencies:

pip install -r requirements.txt

⚙️ Installation

Install the charliehr-client package from PyPi:

pip install charliehr-client

🛠 Usage

Instantiate the Client

from charliehr-client import CharlieHRClient

client_id = "your_client_id"
client_secret = "your_client_secret"

charlie = CharlieHRClient(client_id=client_id, client_secret=client_secret)

Example Operations

# Get all employees
employees = charlie.get_all_employees()

# Get details of a specific employee
employee_details = charlie.get_employee_details(employee_id="employee_uuid")

# Create a new note type
new_note_type = charlie.create_note_type(
    name="Laptop Serial Number",
    note_type="Text",
    owners=True,
    team_leads=True
)

# Create a note for an employee
new_note = charlie.create_employee_note(
    employee_id="employee_uuid",
    note_id="note_type_uuid",
    content="Serial Number: ABC12345"
)

📚 API Methods

Method Description
get_all_bank_accounts() List all bank accounts
get_all_offices() List all offices
get_all_employees() List all employees
get_all_salaries() List all salaries
get_all_note_types() List all note types
get_all_teams() List all teams
get_company_details() Fetch company details
get_office_details(office_id) Fetch specific office details
get_employee_bank_account(user_id) Fetch employee's bank account
get_employee_details(employee_id) Fetch employee's details
get_employee_salary(employee_id) Fetch employee's salary
get_employee_leave_allowance(employee_id) Fetch leave allowance
get_employee_leave_requests(employee_id) Fetch leave requests
get_employee_notes(employee_id) Fetch employee notes
get_note_type_details(note_type_id) Fetch specific note type details
get_team_details(team_id) Fetch team details
create_note_type(...) Create a new note type
create_employee_note(employee_id, note_id, content) Create a note for an employee

🔐 Authentication

Authentication is handled via an Authorization header using your client_id and client_secret:

Authorization: Token token=client_id:client_secret

You can obtain these credentials from your CharlieHR API dashboard.


🛡 Error Handling

If an API request fails:

  • Retries are automatically attempted (up to 3 times by default) with exponential backoff (default 0.3s, 0.6s, 1.2s).
  • Exceptions are raised for HTTP errors, timeouts, or network issues with clear error messages.

📜 License

This client is open-sourced under the MIT License.


Quick Start Example

from charliehr-client import CharlieHRClient

charlie = CharlieHRClient(
    client_id="your_client_id",
    client_secret="your_client_secret"
)

try:
    company = charlie.get_company_details()
    print(company)
except Exception as e:
    print(f"Failed to fetch company info: {e}")

📎 Notes

  • Make sure to securely store your API credentials (client_id and client_secret).
  • Avoid hardcoding credentials in production environments — use environment variables.

🏁 That's it!

You are now ready to automate your CharlieHR workflows using this client! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charliehr_client-1.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

charliehr_client-1.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file charliehr_client-1.0.1.tar.gz.

File metadata

  • Download URL: charliehr_client-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for charliehr_client-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d9ce710541e664596a9234de076db107f449ef14824c0f2c377469ca6598b337
MD5 014cdade8bda5fae7b12bdbb8c827e99
BLAKE2b-256 f2bf94bb1a08418e7317f0a2f40b66c2d42c62505e8d508d4d3e50c36702928a

See more details on using hashes here.

File details

Details for the file charliehr_client-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for charliehr_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8aabdee3476de30306f2b23c1a838bb753598b345adec0ab2e585598a29b5e40
MD5 0b158d4a7b467be5be197d7a7f6b8f67
BLAKE2b-256 223b670ceb945b9e2d7abaf52bc9066eb14cfa9ba7306f4d9d90d5fbfc245b8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page