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.2.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.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: charliehr_client-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4447570af5931a45ebfe3564ed04a4cfd207095aa509a50452abd0141230a32f
MD5 64293a5486425fbfa6110b7a8cf2ef94
BLAKE2b-256 aadfbef6c69017b7ee5f4559884c23e0e74bb0ce258660d7cc976b476a8faf64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for charliehr_client-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acbcab56deb23973e8bf1c212c86ff60f7115e5280ac7198f6ac1989c1508d64
MD5 d60dbe28b9a86780c86611ed5fb78323
BLAKE2b-256 b809dd1d02658c1e4737cac583e3f5557fb6d62fc60cc6f3fe21314837a3bd53

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