Python wrapper for the Greenhouse APIs
Project description
grnhse-api
A python wrapper for the Greenhouse APIs.
For now, only the Harvest API is supported.
Installation
$ pip install grnhse-api
Basic Usage
from grnhse import Harvest
api_key = 'ABCDE12345'
hvst = Harvest(api_key)
# <Harvest API v1>
depts = hvst.departments
depts
# <Departments Endpoint>
depts.get()
# [{'id': 1234,
# 'name': 'Administration',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None},
# {'id': 2345,
# 'name': 'Operations',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None},
# {'id': 3456,
# 'name': 'Engineering',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None},
# ...]
depts.get(1234)
# {'id': 1234,
# 'name': 'Administration',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None}
admin = depts(1234)
admin
# <Departments Endpoint (id=1234)>
admin.get()
# {'id': 1234,
# 'name': 'Administration',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None}
hvst.departments(1234).get()
# {'id': 1234,
# 'name': 'Administration',
# 'parent_id': None,
# 'child_ids': [],
# 'external_id': None}
Pagination
from grnhse import Harvest
api_key = 'ABCDE12345'
hvst = Harvest(api_key)
apps = hvst.applications
apps
# <Applications Endpoint>
all_apps = apps.get()
len(all_apps)
# 100
apps.records_remaining
# True
while apps.records_remaining:
all_apps.extend(apps.get_next())
len(all_apps)
# 437
# Using list comprehension
all_apps = [app for page in apps for app in page]
len(all_apps)
# 437
CHANGELOG
0.1.1 (2020-12-10)
- Update:
requests
package pinned to newer versions - Update: adds the
custom_fields
endpoint - Bugfix: replace
None
with empty string inSessionAuthMixin
0.1.0 (2018-11-10)
- initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
grnhse-api-0.1.1.tar.gz
(5.9 kB
view details)
File details
Details for the file grnhse-api-0.1.1.tar.gz
.
File metadata
- Download URL: grnhse-api-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d98e959dd794bc71b90cb16ca93548d3147032bb53c37b9f29500bb20c522ccc |
|
MD5 | 308680f1d3d83cd56320f682e2bcf34c |
|
BLAKE2b-256 | 740c6cec5c24a1648d0c0cb8d76c2eb54fe1f4dccf4a7925e21c1001173ef9fd |