Skip to main content

A Python wrapper for the Bamboo HR API

Project description

PyBambooHR

Build Status   Download Stats

This is an unofficial Python API for Bamboo HR. So far it is focusing on managing employee information but you can pretty much do anything you want with a little python.

The library makes use of the requests library for Python and HTTPretty for testing. A huge thank you to both of those excellent projects.

Using this library is very simple:

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere')

employees = bamboo.get_employee_directory()

(Note that you have to enable sharing employee directory to use that method.)

This will give you a list of employees with properties on each including their ID.

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere')

# Jim's employee ID is 123 and we are not specifying fields so this will get all of them.
jim = bamboo.get_employee(123)

# Pam's employee ID is 222 and we are specifying fields so this will get only the ones we request.
pam = bamboo.get_employee(222, ['city', 'workPhone', 'workEmail'])

Adding an employee

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere')

# The firstName and lastName keys are required...
employee = {'firstName': 'Test', 'lastName': 'Person'}

result = bamboo.add_employee(employee)

The result dict will contain id and location. "id" is the numerical BambooHR employee ID. Location is a link to that employee.

Updating an employee

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere')

# His name was test person...
employee = {'firstName': 'Another', 'lastName': 'Namenow'}

# Use the ID and then the dict with the new information
result = bamboo.update_employee(333, employee)

result will be True or False depending on if it succeeded.

Requesting a Report

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere')

# Use the ID to request json information
result = bamboo.request_company_report(1, format='json', filter_duplicates=True)

# Now do stuff with your results (Will vary by report.)
for employee in result['employees']:
    print(employee)

# Use the ID and save a pdf:
result = bamboo.request_company_report(1, format='pdf', output_file='/tmp/report.pdf', filter_duplicates=True)

Getting information that is scheduled in the future

from PyBambooHR import PyBambooHR

bamboo = PyBambooHR(subdomain='yoursub', api_key='yourapikeyhere', only_current=False)

BambooHR has effective dates for when promotions are scheduled to happen or when new hires are going to join the organization. In order to see these events before they happen using the BambooHR API set only_current to False. As a note, this only works for pulling reports and getting employee information. This does not work on getting the employee directory.

CHANGES

Version 0.4.2 - 03 October 2014

  • Added row_id to row dictionary to keep track of them in case we need them.

Version 0.3.6 - 03 October 2014

  • Improvements by Ng Zhi An

Version 0.3.1 - 24 February 2014

  • Raise errors on non-200 statuses

Version 0.3.0 - 23 February 2014

  • Company Reports
  • Custom Reports

Version 0.2.0 - 05 October 2013

  • Underscore key support
  • Better test coverage

Version 0.1.0 - 02 October 2013

  • Pre-Alpha version
  • Uses Bamboo HR API to get employee info.

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

PyBambooHR-0.8.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

PyBambooHR-0.8.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file PyBambooHR-0.8.1.tar.gz.

File metadata

  • Download URL: PyBambooHR-0.8.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for PyBambooHR-0.8.1.tar.gz
Algorithm Hash digest
SHA256 af32b36f0049a62e8ba4bedda7223e3cab3e8be548deaddc0ff798facf16da54
MD5 a884ebb0d4310a092147f37e2edeab7f
BLAKE2b-256 81b89ce02508704c3d6bb2c1ccbc98e3eed750383e4492acb6e4b83bf92eba7c

See more details on using hashes here.

File details

Details for the file PyBambooHR-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: PyBambooHR-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for PyBambooHR-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31eb7f49dbc7668616401ceaa2548d64d1d147441550c96843884453d5ce932b
MD5 46325dd230c49f02d12546fc6e991b71
BLAKE2b-256 446700113f1c0200113e44e4739d739b007b2497ba3f9b3ab682eeae638ed370

See more details on using hashes here.

Supported by

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