ukg 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ukg/__init__.py +483 -0
- ukg-0.2.0.dist-info/METADATA +58 -0
- ukg-0.2.0.dist-info/RECORD +6 -0
- ukg-0.2.0.dist-info/WHEEL +5 -0
- ukg-0.2.0.dist-info/licenses/LICENSE +121 -0
- ukg-0.2.0.dist-info/top_level.txt +1 -0
ukg/__init__.py
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import calendar
|
|
2
|
+
from datetime import datetime, date, timedelta
|
|
3
|
+
import json
|
|
4
|
+
import requests
|
|
5
|
+
from time import sleep
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def split_by_month(start_date, end_date):
|
|
9
|
+
start = datetime.strptime(start_date, "%Y-%m-%d").date()
|
|
10
|
+
end = datetime.strptime(end_date, "%Y-%m-%d").date()
|
|
11
|
+
|
|
12
|
+
ranges = []
|
|
13
|
+
current = start
|
|
14
|
+
|
|
15
|
+
while current <= end:
|
|
16
|
+
last_day = calendar.monthrange(current.year, current.month)[1]
|
|
17
|
+
month_end = date(current.year, current.month, last_day)
|
|
18
|
+
|
|
19
|
+
range_end = min(month_end, end)
|
|
20
|
+
|
|
21
|
+
ranges.append(
|
|
22
|
+
(
|
|
23
|
+
current.strftime("%Y-%m-%d"),
|
|
24
|
+
range_end.strftime("%Y-%m-%d"),
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
current = range_end + timedelta(days=1)
|
|
29
|
+
|
|
30
|
+
return ranges
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class UKG:
|
|
34
|
+
def __init__(self, host, company, username, password, api_key, token=None):
|
|
35
|
+
self.host = "https://" + host
|
|
36
|
+
self.company = company
|
|
37
|
+
self.username = username
|
|
38
|
+
self.password = password
|
|
39
|
+
self.api_key = api_key
|
|
40
|
+
self.token = token
|
|
41
|
+
|
|
42
|
+
def _headers(self):
|
|
43
|
+
return {
|
|
44
|
+
"Accept": "application/json",
|
|
45
|
+
"Authorization": "Bearer " + self.token,
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def login(self):
|
|
50
|
+
print("[ukg] login")
|
|
51
|
+
if self.token:
|
|
52
|
+
print("[ukg] already logged in")
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
url = self.host + "/ta/rest/v1/login"
|
|
56
|
+
data = {
|
|
57
|
+
"credentials": {
|
|
58
|
+
"company": self.company,
|
|
59
|
+
"username": self.username,
|
|
60
|
+
"password": self.password,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
headers = {
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
"Accept": "application/json",
|
|
66
|
+
"api-key": self.api_key,
|
|
67
|
+
}
|
|
68
|
+
response = requests.post(url, headers=headers, json=data)
|
|
69
|
+
data = response.json()
|
|
70
|
+
token = data["token"]
|
|
71
|
+
self.token = token
|
|
72
|
+
|
|
73
|
+
def lookup_items(self, url):
|
|
74
|
+
print("[ukg] GET " + url)
|
|
75
|
+
response = requests.get(url, headers=self._headers())
|
|
76
|
+
data = response.json()
|
|
77
|
+
if "items" not in data:
|
|
78
|
+
print("[ukg]", data)
|
|
79
|
+
raise Exception("[ukg] missing items in response")
|
|
80
|
+
items = data["items"]
|
|
81
|
+
return items
|
|
82
|
+
|
|
83
|
+
def get_cost_center_lists(self):
|
|
84
|
+
print("[ukg] getting cost center lists")
|
|
85
|
+
|
|
86
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
87
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/config/cost-centers/lists"
|
|
88
|
+
print("[ukg] GET " + url)
|
|
89
|
+
|
|
90
|
+
response = requests.get(url, headers=self._headers())
|
|
91
|
+
|
|
92
|
+
data = response.json()
|
|
93
|
+
|
|
94
|
+
if "cost_center_lists" not in data:
|
|
95
|
+
raise Exception("[ukg] cost_center_lists missing in response data")
|
|
96
|
+
|
|
97
|
+
return data["cost_center_lists"]
|
|
98
|
+
|
|
99
|
+
def get_cost_centers(self, tree_index=0):
|
|
100
|
+
print("[ukg] getting cost centers")
|
|
101
|
+
|
|
102
|
+
if tree_index is None:
|
|
103
|
+
raise Exception("[ukg] missing tree_index")
|
|
104
|
+
|
|
105
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
106
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/config/cost-centers?tree_index={tree_index}"
|
|
107
|
+
print("[ukg] GET " + url)
|
|
108
|
+
|
|
109
|
+
response = requests.get(url, headers=self._headers())
|
|
110
|
+
|
|
111
|
+
data = response.json()
|
|
112
|
+
|
|
113
|
+
if "cost_centers" not in data:
|
|
114
|
+
print("[ukg]", data)
|
|
115
|
+
raise Exception("[ukg] cost_centers missing from response data")
|
|
116
|
+
|
|
117
|
+
cost_centers = data["cost_centers"]
|
|
118
|
+
|
|
119
|
+
return cost_centers
|
|
120
|
+
|
|
121
|
+
# gets all the tree index numbers that are actively being used
|
|
122
|
+
def get_tree_indices(self):
|
|
123
|
+
tree_indices = set()
|
|
124
|
+
for cost_center in self.get_cost_center_lists():
|
|
125
|
+
tree_indices.add(cost_center["tree_index"])
|
|
126
|
+
|
|
127
|
+
results = list(sorted(list(tree_indices)))
|
|
128
|
+
|
|
129
|
+
return results
|
|
130
|
+
|
|
131
|
+
def get_all_cost_centers(self):
|
|
132
|
+
tree_indices = self.get_tree_indices()
|
|
133
|
+
results = []
|
|
134
|
+
for tree_index in tree_indices:
|
|
135
|
+
cost_centers = self.get_cost_centers(tree_index=tree_index)
|
|
136
|
+
for cost_center in cost_centers:
|
|
137
|
+
cost_center["tree_index"] = tree_index
|
|
138
|
+
results.append(cost_center)
|
|
139
|
+
return results
|
|
140
|
+
|
|
141
|
+
def get_employees(self):
|
|
142
|
+
print("[ukg] getting employees")
|
|
143
|
+
|
|
144
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
145
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/employees"
|
|
146
|
+
print("[ukg] GET " + url)
|
|
147
|
+
|
|
148
|
+
response = requests.get(url, headers=self._headers())
|
|
149
|
+
|
|
150
|
+
data = response.json()
|
|
151
|
+
|
|
152
|
+
if "employees" not in data:
|
|
153
|
+
print("[ukg]", data)
|
|
154
|
+
raise Exception("[ukg] 'employees' not in data")
|
|
155
|
+
|
|
156
|
+
employees = data["employees"]
|
|
157
|
+
|
|
158
|
+
return employees
|
|
159
|
+
|
|
160
|
+
def get_time_entry_sets(self, start_date, end_date):
|
|
161
|
+
print(f"[ukg] getting time entry sets from {start_date} to {end_date}")
|
|
162
|
+
|
|
163
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
164
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/time-entries"
|
|
165
|
+
print("[ukg] GET " + url)
|
|
166
|
+
|
|
167
|
+
params = {"start_date": start_date, "end_date": end_date}
|
|
168
|
+
response = requests.get(url, headers=self._headers(), params=params)
|
|
169
|
+
|
|
170
|
+
data = response.json()
|
|
171
|
+
|
|
172
|
+
if "time_entry_sets" not in data:
|
|
173
|
+
print("[ukg]", data)
|
|
174
|
+
raise Exception("[ukg] 'time_entry_sets' not in data")
|
|
175
|
+
|
|
176
|
+
return data["time_entry_sets"]
|
|
177
|
+
|
|
178
|
+
def get_time_offs(self):
|
|
179
|
+
print("[ukg] getting time_offs")
|
|
180
|
+
|
|
181
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
182
|
+
url = f"{self.host}/ta/rest/v1/company/timeoffs"
|
|
183
|
+
print("[ukg] GET " + url)
|
|
184
|
+
|
|
185
|
+
params = {
|
|
186
|
+
"company": self.company,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
response = requests.get(url, headers=self._headers(), params=params)
|
|
190
|
+
|
|
191
|
+
data = response.json()
|
|
192
|
+
|
|
193
|
+
if "time_offs" not in data:
|
|
194
|
+
print("[ukg]", data)
|
|
195
|
+
raise Exception("[ukg] 'time_offs' not in data")
|
|
196
|
+
|
|
197
|
+
return data["time_offs"]
|
|
198
|
+
|
|
199
|
+
def export_time_entries(self, start_date, end_date=None):
|
|
200
|
+
|
|
201
|
+
employees = self.get_employees()
|
|
202
|
+
employees_by_id = dict([(employee["id"], employee) for employee in employees])
|
|
203
|
+
|
|
204
|
+
all_cost_centers = self.get_all_cost_centers()
|
|
205
|
+
all_cost_centers_lookup = dict(
|
|
206
|
+
[
|
|
207
|
+
((cost_center["tree_index"], cost_center["id"]), cost_center)
|
|
208
|
+
for cost_center in all_cost_centers
|
|
209
|
+
]
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
time_offs = self.get_time_offs()
|
|
213
|
+
time_offs_by_id = dict([(time_off["id"], time_off) for time_off in time_offs])
|
|
214
|
+
|
|
215
|
+
if not start_date:
|
|
216
|
+
pass
|
|
217
|
+
if not end_date:
|
|
218
|
+
print("[ukg] using current date as end_date")
|
|
219
|
+
end_date = datetime.now().date().strftime("%Y-%m-%d")
|
|
220
|
+
|
|
221
|
+
start_datetime = datetime.strptime(start_date, "%Y-%m-%d")
|
|
222
|
+
end_datetime = datetime.strptime(end_date, "%Y-%m-%d")
|
|
223
|
+
|
|
224
|
+
# UKG doesn't let you request more than 31 days at a time,
|
|
225
|
+
# so we break things up by month when requesting more than 31 days
|
|
226
|
+
if (end_datetime - start_datetime).days <= 31:
|
|
227
|
+
time_pairs = [(start_date, end_date)]
|
|
228
|
+
else:
|
|
229
|
+
time_pairs = split_by_month(start_date, end_date)
|
|
230
|
+
|
|
231
|
+
results = []
|
|
232
|
+
|
|
233
|
+
for start_date, end_date in time_pairs:
|
|
234
|
+
print(f"[ukg] there are {len(results)} rows so far")
|
|
235
|
+
print("[ukg] sleeping for 2 seconds")
|
|
236
|
+
sleep(2)
|
|
237
|
+
time_entry_sets = self.get_time_entry_sets(
|
|
238
|
+
start_date=start_date, end_date=end_date
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
for time_entry_set in time_entry_sets:
|
|
242
|
+
employee = time_entry_set["employee"]
|
|
243
|
+
employee_account_id = employee["account_id"]
|
|
244
|
+
employee_record = employees_by_id[employee_account_id]
|
|
245
|
+
|
|
246
|
+
time_entry_set_start_date = time_entry_set["start_date"]
|
|
247
|
+
time_entry_set_end_date = time_entry_set["end_date"]
|
|
248
|
+
|
|
249
|
+
for time_entry in time_entry_set["time_entries"]:
|
|
250
|
+
time_entry_cost_centers = time_entry.get("cost_centers", [])
|
|
251
|
+
time_entry_cost_centers_names = []
|
|
252
|
+
for cost_center in time_entry_cost_centers:
|
|
253
|
+
cost_center_tree_index = cost_center["index"]
|
|
254
|
+
cost_center_id = cost_center["value"]["id"]
|
|
255
|
+
cost_center_lookup_key = (
|
|
256
|
+
cost_center_tree_index,
|
|
257
|
+
cost_center_id,
|
|
258
|
+
)
|
|
259
|
+
cost_center_name = all_cost_centers_lookup[
|
|
260
|
+
cost_center_lookup_key
|
|
261
|
+
]["name"]
|
|
262
|
+
time_entry_cost_centers_names.append(cost_center_name)
|
|
263
|
+
time_entry_cost_centers_names = ",".join(
|
|
264
|
+
time_entry_cost_centers_names
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
if time_entry.get("custom_fields"):
|
|
268
|
+
print("custom_fields:", time_entry.get("custom_fields"))
|
|
269
|
+
|
|
270
|
+
row = {
|
|
271
|
+
"employee.account_id": employee_account_id,
|
|
272
|
+
"employee.employee_id": employee_record["employee_id"],
|
|
273
|
+
"employee.external_id": employee_record.get("external_id"),
|
|
274
|
+
"employee.username": employee_record["username"],
|
|
275
|
+
"employee.first_name": employee_record["first_name"],
|
|
276
|
+
"employee.last_name": employee_record["last_name"],
|
|
277
|
+
"employee.status": employee_record["status"],
|
|
278
|
+
"time_entry_set_start_date": time_entry_set_start_date,
|
|
279
|
+
"time_entry_set_end_date": time_entry_set_end_date,
|
|
280
|
+
"id": time_entry["id"],
|
|
281
|
+
"date": time_entry["date"],
|
|
282
|
+
"type": time_entry["type"],
|
|
283
|
+
"start_time": time_entry.get("start_time"),
|
|
284
|
+
"end_time": time_entry.get("end_time"),
|
|
285
|
+
"total": time_entry.get("total"),
|
|
286
|
+
"time_off.id": time_entry.get("time_off", {}).get("id"),
|
|
287
|
+
"time_off.name": time_offs_by_id.get(
|
|
288
|
+
time_entry.get("time_off", {}).get("id"), {}
|
|
289
|
+
).get("name"),
|
|
290
|
+
"pay_category.id": time_entry.get("pay_category", {}).get("id"),
|
|
291
|
+
"premium_shift.id": time_entry.get("premium_shift", {}).get(
|
|
292
|
+
"id"
|
|
293
|
+
),
|
|
294
|
+
# convert to human readable form
|
|
295
|
+
"cost_centers.names": time_entry_cost_centers_names,
|
|
296
|
+
"custom_fields": time_entry.get("custom_fields"),
|
|
297
|
+
"custom_decimal": time_entry.get("custom_decimal"),
|
|
298
|
+
"approval_status": time_entry["approval_status"],
|
|
299
|
+
"is_raw": time_entry["is_raw"],
|
|
300
|
+
"is_calc": time_entry["is_calc"],
|
|
301
|
+
"calc_start_time": time_entry.get("calc_start_time"),
|
|
302
|
+
"calc_end_time": time_entry.get("calc_end_time"),
|
|
303
|
+
"calc_total": time_entry.get(
|
|
304
|
+
"calc_total"
|
|
305
|
+
), # total calculated time in milliseconds
|
|
306
|
+
"calc_pay_category.id": time_entry.get(
|
|
307
|
+
"calc_pay_category", {}
|
|
308
|
+
).get("id"),
|
|
309
|
+
"calc_premium_shift.id": time_entry.get(
|
|
310
|
+
"calc_premium_shift", {}
|
|
311
|
+
).get("id"),
|
|
312
|
+
"piecework": time_entry.get("piecework"),
|
|
313
|
+
"amount": time_entry.get("amount"),
|
|
314
|
+
}
|
|
315
|
+
results.append(row)
|
|
316
|
+
|
|
317
|
+
return results
|
|
318
|
+
|
|
319
|
+
def export_employees(self):
|
|
320
|
+
rows = []
|
|
321
|
+
|
|
322
|
+
employees = self.get_employees()
|
|
323
|
+
|
|
324
|
+
profiles = {
|
|
325
|
+
"accruals": dict([(it["id"], it) for it in self.lookup_accruals()]),
|
|
326
|
+
"holiday": dict([(it["id"], it) for it in self.lookup_holiday_profiles()]),
|
|
327
|
+
"pay_calculations": dict(
|
|
328
|
+
[(it["id"], it) for it in self.lookup_pay_calculation_profiles()]
|
|
329
|
+
),
|
|
330
|
+
"pay_prep": dict(
|
|
331
|
+
[(it["id"], it) for it in self.lookup_pay_prep_profiles()]
|
|
332
|
+
),
|
|
333
|
+
"pay_period": dict(
|
|
334
|
+
[(it["id"], it) for it in self.lookup_pay_period_profiles()]
|
|
335
|
+
),
|
|
336
|
+
"security": dict(
|
|
337
|
+
[(it["id"], it) for it in self.lookup_security_profiles()]
|
|
338
|
+
),
|
|
339
|
+
"scheduler": dict(
|
|
340
|
+
[(it["id"], it) for it in self.lookup_scheduler_profiles()]
|
|
341
|
+
),
|
|
342
|
+
"timesheet": dict(
|
|
343
|
+
[(it["id"], it) for it in self.lookup_timesheet_profiles()]
|
|
344
|
+
),
|
|
345
|
+
"ts_auto_population": dict(
|
|
346
|
+
[
|
|
347
|
+
(it["id"], it)
|
|
348
|
+
for it in self.lookup_timesheet_auto_population_profiles()
|
|
349
|
+
]
|
|
350
|
+
),
|
|
351
|
+
"work_schedule": dict(
|
|
352
|
+
[(it["id"], it) for it in self.lookup_work_schedule_profiles()]
|
|
353
|
+
),
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
for iemployee, employee in enumerate(employees):
|
|
357
|
+
print("[ukg] iemployee:", iemployee)
|
|
358
|
+
|
|
359
|
+
row = {
|
|
360
|
+
"id": employee["id"],
|
|
361
|
+
"employee_id": employee["employee_id"],
|
|
362
|
+
"external_id": employee.get(
|
|
363
|
+
"external_id", "ERROR: missing external_id"
|
|
364
|
+
),
|
|
365
|
+
"username": employee["username"],
|
|
366
|
+
"first_name": employee["first_name"],
|
|
367
|
+
"last_name": employee["last_name"],
|
|
368
|
+
"status": employee["status"],
|
|
369
|
+
"dates.hired": employee["dates"]["hired"],
|
|
370
|
+
"dates.started": employee["dates"]["started"],
|
|
371
|
+
"dates.terminated": employee["dates"].get("terminated", None),
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
links = employee["_links"]
|
|
375
|
+
url = links["profiles"]
|
|
376
|
+
print("[ukg] GET " + url)
|
|
377
|
+
response = requests.get(url, headers=self._headers())
|
|
378
|
+
data = response.json()
|
|
379
|
+
|
|
380
|
+
for key, values in data.items():
|
|
381
|
+
if key not in profiles:
|
|
382
|
+
continue
|
|
383
|
+
|
|
384
|
+
# sort values
|
|
385
|
+
values = sorted(values, key=lambda it: it["effective_from"])
|
|
386
|
+
|
|
387
|
+
if len(values) >= 1:
|
|
388
|
+
lookup_table = profiles[key]
|
|
389
|
+
id = values[-1]["id"]
|
|
390
|
+
if id not in lookup_table:
|
|
391
|
+
row["profiles." + key] = (
|
|
392
|
+
f"ERROR: id of ({id}) not found in lookup table"
|
|
393
|
+
)
|
|
394
|
+
else:
|
|
395
|
+
row["profiles." + key] = lookup_table[id].get(
|
|
396
|
+
"display_name", "ERROR: missing display_name"
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
rows.append(row)
|
|
400
|
+
|
|
401
|
+
return rows
|
|
402
|
+
|
|
403
|
+
# this is the unique primary key id, not the "employee id"
|
|
404
|
+
def get_employee(self, employee_id):
|
|
405
|
+
print(f"[ukg] getting employee")
|
|
406
|
+
|
|
407
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
408
|
+
url = (
|
|
409
|
+
f"{self.host}/ta/rest/v2/companies/|{self.company}/employees/{employee_id}"
|
|
410
|
+
)
|
|
411
|
+
print("[ukg] GET " + url)
|
|
412
|
+
response = requests.get(url, headers=self._headers())
|
|
413
|
+
|
|
414
|
+
data = response.json()
|
|
415
|
+
|
|
416
|
+
return data
|
|
417
|
+
|
|
418
|
+
# this is the unique primary key id, not the "employee id"
|
|
419
|
+
def get_employee_pay_info(self, employee_id):
|
|
420
|
+
print(f"[ukg] getting employee pay info")
|
|
421
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
422
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/employees/{employee_id}/pay-info"
|
|
423
|
+
print("[ukg] GET " + url)
|
|
424
|
+
|
|
425
|
+
response = requests.get(url, headers=self._headers())
|
|
426
|
+
|
|
427
|
+
data = response.json()
|
|
428
|
+
|
|
429
|
+
return data
|
|
430
|
+
|
|
431
|
+
# this is the unique primary key id, not the "employee id"
|
|
432
|
+
def get_employee_profiles(self, employee_id):
|
|
433
|
+
print(f"[ukg] getting employee profile")
|
|
434
|
+
|
|
435
|
+
# yes, the pipe is required. yes, that's crazy.
|
|
436
|
+
url = f"{self.host}/ta/rest/v2/companies/|{self.company}/employees/{employee_id}/profiles"
|
|
437
|
+
print("[ukg] GET " + url)
|
|
438
|
+
|
|
439
|
+
response = requests.get(url, headers=self._headers())
|
|
440
|
+
|
|
441
|
+
data = response.json()
|
|
442
|
+
|
|
443
|
+
return data
|
|
444
|
+
|
|
445
|
+
def lookup_profiles(self, slug):
|
|
446
|
+
print("[ukg] looking up profile")
|
|
447
|
+
url = (
|
|
448
|
+
f"{self.host}/ta/rest/v2/companies/|{self.company}/lookup/profiles/" + slug
|
|
449
|
+
)
|
|
450
|
+
return self.lookup_items(url)
|
|
451
|
+
|
|
452
|
+
def lookup_accruals(self):
|
|
453
|
+
return self.lookup_profiles("accruals")
|
|
454
|
+
|
|
455
|
+
def lookup_holiday_profiles(self):
|
|
456
|
+
return self.lookup_profiles("holiday-profiles")
|
|
457
|
+
|
|
458
|
+
def lookup_pay_calculation_profiles(self):
|
|
459
|
+
return self.lookup_profiles("pay-calc2-profiles")
|
|
460
|
+
|
|
461
|
+
def lookup_pay_period_profiles(self):
|
|
462
|
+
return self.lookup_profiles("pay-period-profiles")
|
|
463
|
+
|
|
464
|
+
def lookup_pay_prep_profiles(self):
|
|
465
|
+
return self.lookup_profiles("pay-prep-profiles")
|
|
466
|
+
|
|
467
|
+
def lookup_scheduler_profiles(self):
|
|
468
|
+
return self.lookup_profiles("scheduler-profiles")
|
|
469
|
+
|
|
470
|
+
def lookup_security_profiles(self):
|
|
471
|
+
return self.lookup_profiles("security-profiles")
|
|
472
|
+
|
|
473
|
+
def lookup_time_off_planning_profiles(self):
|
|
474
|
+
return self.lookup_profiles("time-off-planning-profiles")
|
|
475
|
+
|
|
476
|
+
def lookup_timesheet_profiles(self):
|
|
477
|
+
return self.lookup_profiles("timesheet-profiles")
|
|
478
|
+
|
|
479
|
+
def lookup_timesheet_auto_population_profiles(self):
|
|
480
|
+
return self.lookup_profiles("ts-auto-population-profiles")
|
|
481
|
+
|
|
482
|
+
def lookup_work_schedule_profiles(self):
|
|
483
|
+
return self.lookup_profiles("workschedule-profiles")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ukg
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Unofficial UKG Ready Python Client
|
|
5
|
+
Home-page: https://github.com/gocarta/ukg.py
|
|
6
|
+
Download-URL: https://github.com/gocarta/ukg.py/tarball/download
|
|
7
|
+
Author: Daniel J. Dufour
|
|
8
|
+
Author-email: daniel.j.dufour@gmail.com
|
|
9
|
+
Keywords: data,python
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: description
|
|
21
|
+
Dynamic: description-content-type
|
|
22
|
+
Dynamic: download-url
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: keywords
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# ukg.py
|
|
30
|
+
Unofficial UKG Python Client
|
|
31
|
+
|
|
32
|
+
## install
|
|
33
|
+
```sh
|
|
34
|
+
pip install ukg
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## usage
|
|
38
|
+
```py
|
|
39
|
+
from ukg import UKG
|
|
40
|
+
|
|
41
|
+
UKG_HOST = se.get("UKG_HOST")
|
|
42
|
+
UKG_COMPANY = se.get("UKG_COMPANY")
|
|
43
|
+
UKG_USERNAME = se.get("UKG_USERNAME")
|
|
44
|
+
UKG_PASSWORD = se.get("UKG_PASSWORD")
|
|
45
|
+
UKG_API_KEY = se.get("UKG_API_KEY")
|
|
46
|
+
|
|
47
|
+
ukg = UKG(
|
|
48
|
+
host=UKG_HOST,
|
|
49
|
+
company=UKG_COMPANY,
|
|
50
|
+
username=UKG_USERNAME,
|
|
51
|
+
password=UKG_PASSWORD,
|
|
52
|
+
api_key=UKG_API_KEY
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
ukg.login()
|
|
56
|
+
|
|
57
|
+
results = ukg.export_employees()
|
|
58
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ukg/__init__.py,sha256=EC9JyVr99__Q-8rpMuHT_UTCXpLFgcNit6tA_6OvpW0,18234
|
|
2
|
+
ukg-0.2.0.dist-info/licenses/LICENSE,sha256=9Ofzc7m5lpUDN-jUGkopOcLZC3cl6brz1QhKInF60yg,7169
|
|
3
|
+
ukg-0.2.0.dist-info/METADATA,sha256=u3-GgBkiAD1LQIP6hJ_SJD2uyU4gG-YcGCLihGSipNg,1359
|
|
4
|
+
ukg-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
ukg-0.2.0.dist-info/top_level.txt,sha256=HqJXTHCIT1Q5h2SJDNKvlDKdV9ZVP5MJcrnk1_JThUs,4
|
|
6
|
+
ukg-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ukg
|