-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.py
32 lines (26 loc) · 970 Bytes
/
job.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from datetime import datetime
import pytz
import data_config
class Job:
def __init__(self, job):
self.job = job
self._extract_job_info()
delattr(self, "job")
def _remove_whitespace(self, s):
if s is not None:
s = str(s)
s = s.strip().strip("\n").strip("\t")
s = s.replace("\n", " ").replace("\t", " ")
return s
def _convert_datetime(self, unix_timestamp):
timestamp_without_miliseconds = unix_timestamp / 1000.0
tz = pytz.timezone("America/Los_Angeles")
return datetime.fromtimestamp(timestamp_without_miliseconds, tz).strftime(
"%Y-%m-%d %H:%M:%S"
)
def _extract_job_info(self):
self._extract_requisition_fields()
def _extract_requisition_fields(self):
for field in data_config.requisition_fields:
value = self._remove_whitespace(self.job.get(field, ""))
setattr(self, field, value)