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


⚙️ Installation

Install the charliehr-client package from PyPi:

pip install charliehr-client

🛠 Usage

Instantiate the Client

from charliehr 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(employee_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 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.3.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.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: charliehr_client-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 fb69dcef6e8643045997ce0bc5640ce75a93d4082684fcc5b510db2fcd1e4c6c
MD5 7f1b2e7b8637693003aee0bd983c8be6
BLAKE2b-256 708fb7668cea4a3f4889e35a7763b1eab4de33314ab671f32f76832763153860

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for charliehr_client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47936e2e1e491d4fcc172693685784875ea7c76023b183cc15b9b94763cb7636
MD5 1ea3bb659d211c4ad75f362fca5137c4
BLAKE2b-256 42eaf2c71c4649596485cd16a2d67ebd62eb673cee3470d05a21efb39c73ac67

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